Hanson shot a round of 64 to move to 14-under-par, but Ryder Cup teammate and world number one Rory McIlroy kept the Swede within striking distance with a round of 65, putting him just two shots behind the lead.
Robert Karlsson sits third having also shot a 64 to put him on nine-under, while round one leader Jamie Donaldson blew a four-shot lead over the pack with a 74, putting him alongside Justin Rose and Shane Lowry in being six behind the new leader.
Hanson will now play with McIlroy on day three of the tournament, and the 35-year-old is relishing the opportunity.
"I'm really looking forward to it," Hanson said. "Playing with the world number one is always fun - it used to be Tiger, now it's Rory.
"I like to test myself and there's no better way than head-to-head. It's a good way to test your mental abilities and if you can play well it makes it so much nicer.
"I'll be playing 30-40 yards behind him and he's going to be tough to beat, but hopefully I can give him a match."
McIlroy is looking to retain his Shanghai title, having won on the same course last year.