Oosthuizen opened with five straight birdies and closed with two birdies in his last three holes for a 65.
McIlroy was at 15-under 201 as he goes for his fourth victory of the year and tries to move a little closer to the No. 1 ranking.
Li Haotong of China had a robust crowd going early with five birdies through six holes to take the lead, only to shoot 42 on the back nine for a 74 that knocked him out of contention.
McIlroy had no such troubles and was rarely in trouble aside from an 8-foot par save on the opening hole and a 6-footer for par after hitting wedge just short into the bunker.
He didn't miss a fairway from the third hole until the par-5 18th, where he had to play short of the water before hitting a towering lob wedge that caught the ridge with enough spin to roll back toward the cup.
Defending champion Xander Schauffele felt a little better in his battle to recover from the flu, and it showed early when he opened with three straight birdies and missed an 8-foot putt that would have been four in a row. He overcame a few mistakes around the turn and finished with three straight birdies for a 68 to finish two off the lead.
This is the only World Golf Championships event where no one has won back-to-back, and Schauffele is in the best shape to try to keep the WGCs in American hands for the eighth straight time.
He was tied at 13-under with Matt Fitzpatrick (70), who kept his bogey-free streak going with a 70-foot par putt on the fifth hole, only to miss a 4-foot par putt on the seventh hole, his first bogey since the first hole of the tournament.
He dropped two more shots on the back and didn't make enough birdies — or as many birdies as everyone around him on another prime afternoon in Shanghai — to keep pace.
Eight players were within five shots of the lead, including Sungjae Im (70) and Match Play champion Kevin Kisner (67), both hopeful of being wild-card selections next week for the Presidents Cup.
But they are chasing McIlroy, no small task when he's swinging like this.
"Played with Rory the last two rounds last week. He's absolutely striping it," Oosthuizen said. "I need to play really good golf tomorrow."
Oosthuizen did his part early with five straight birdies, and he wasn't alone in making a move up the leaderboard. When the final group reached the par-5 eighth hole, the leaderboard behind the green had Li at 13 under, three others at 12 under, and two more at 11 under. McIlroy was 2 under at that point and felt as though he wasn't getting enough out of his round.
McIlroy missed a 5-foot birdie putt, but he answered with a bold 7-iron over the water to 4 feet for birdie on the ninth. More importantly, he didn't give anything back.
"I guess at that point I felt like I needed to get more out of my round to get into the lead, but the back nine played tough," he said. I did what I needed to do. I birdied the two par 5s and didn't drop any shots."
He left that to everyone around him.
Li's problems started behind the eighth green with a shot so delicate out of the Bermuda rough that he stubbed it only a few inches. He did well to escape with bogey. But on the 13th, Li went from a greenside bunker over the green and into a hazard, leading to triple bogey. He bogeyed his last two holes.
Adam Scott was two shots out of the lead until a double bogey on the par-5 eight, and bogeys on the ninth and 11th holes. He never recovered and hit into the water on the 18th, getting up-and-down to save par for a 75.
Paul Waring of England had eight birdies until going into the water on the 18th for a bogey and a 66, leaving him three shots back.
And then there was Phil Mickelson, who made only two pars over his final 13 holes — along with four birdies and seven bogeys — for a 75 that left him 14 shots behind. In a tie for 38th, Mickelson is likely to soon end his streak of nearly 26 years in the top 50, a record for the Official World Golf Ranking.