The Swede saw his overnight advantage halved following a round of 70 to reach 16-under par, while playing partner and Ryder Cup team-mate McIlroy carded a 69.
Both birdied the 384-yard second at Lake Malaren, although Hanson dropped shots at the fourth, fifth and eighth with world number one McIlroy taking a share of the lead despite a bogey six at the third.
But Hanson picked up a shot at the ninth and both players came home in 33 to hold off the chasing pack, led by South African George Coetzee.
He is three off the lead after a 66 with two more Ryder Cup heroes in Luke Donald and Justin Rose ready to pounce in a group of six players on 11 under.
World number 25 Hanson opened the tournament with rounds of 66 and 64, and was looking for a similar effort on Sunday to secure top spot at the $7 million event.
"The wind was blowing from opposite direction today which made it a little bit trickier, and some of the pins were tucked away," he said.
"It's great to play with Rory. Every time you get the chance to play against the world number one it's a fantastic thing to do.
"Hopefully I can stay ahead of him but I think it's going to be a tough one tomorrow and I need to play a little bit better than I did today.
"Winning on the European Tour is always massive and this is the start of a big stretch for us. If I can get it back to the first two rounds I think I've got a good chance."
McIlroy, who won the Shanghai Masters on the same Lake Malaren course last year, is seeking his fifth victory of the season.
- Sports & Recreation