The hosts dominated the morning courtesy of a sparkling unbeaten century from Matthew Wade before declaring at 432-9 with a first innings lead of 138 just before lunch.
The tourists stormed back in the second session on the back of a century partnership between Dimuth Karunaratne (85) and skipper Mahela Jayawardene (60) to fleetingly raise the prospect of a first ever Sri Lanka test win in Australia.
Karunaratne fell short of his maiden test century soon after tea with his country still six runs in arrears, however, and Sri Lanka then crumbled to lose six wickets for just 93 runs.
At stumps, Dinesh Chandimal (22) and Rangana Herath (9) were at the crease facing a huge task to extend the lead and make Australia's chase anything more than a formality.
"It could have gone pear-shaped quickly," Wade told reporters. "It could have gone the wrong way for us this afternoon but luckily enough our bowlers were good enough and they did well to pull it back.
"We've got to take three wickets as quickly as we can because we don't want to be chasing too many on that wicket."
Tillakaratne Dilshan departed for five after just half an hour of the Sri Lanka innings but Karunaratne soon indicated he was in no mood to capitulate.
The 24-year-old lefthander, playing only his fourth test, smashed 11 boundaries in his 109-ball knock - the best of them a huge lofted six over long-on with which he brought up his second test fifty.
He survive a big scare on 54 when he was dropped behind by Wade but departed soon after tea when the wicketkeeper held on to the ball when Karunaratne was drawn into an edge by Jackson Bird's reverse swing.
Lahiru Thirimanne (7), Thilan Samaraweera (0), Angelo Mathews (16), Jayawardene and Dhammika Prasad (15) then followed to leave the tourists floundering.
"We were very disappointed with the batting in the last session," Karunaratne SAID.
"If Chandimal can put some runs on the board tomorrow, we can do something on this track. I think 150, 175 would be a good target for us.
"The wicket is turning a lot now and the Aussie guys are playing the fourth innings, so I think (spinners) Rangana and Dilshan can do something."
Samaraweera's wicket received the biggest cheer of the day as Mike Hussey, playing in his final test before retirement, took the catch in the deep off the bowling of Nathan Lyon.
The 37-year-old batsman got another rousing ovation when he bowled the last over of the day.
Wade had earned plenty of cheers in the opening session with a knock of 102 as bright as the pink shirts and hats being worn by much of the crowd in support of former Australia fast bowler Glenn McGrath's breast cancer charity.
The lefthander resumed on 47 with Australia just 48 runs ahead of Sri Lanka's first innings tally of 294 and he reached his third test half century in the second over.
Initially combining with Peter Siddle (38) in a partnership of 77 for the seventh wicket, the sheer power of his strokes had the 24,675 crowd purring in the Sydney sunshine.
When Siddle, Mitchell Starc and Lyon were dismissed in quick succession it looked like the last rites for Australia's innings at 393-9.
Wade, who was on 70, had other ideas and with Bird at the other end offering support with his first six test runs, he bludgeoned his way to his second test century.
He reached the mark by smashing his ninth four to deep cover and then raced around the ground, arms outstretched, in an emotional celebration of his first hundred on home soil.
"It was an amazing feeling. To do it on a day like today, with the McGrath foundation day, was something special. I will never forget it," said Wade, who was diagnosed with testicular cancer as a teenager.
The 25-year-old faced just two more balls but still had time to be dropped on the boundary by Prasad before captain Michael Clarke decided the lead was big enough and declared.
- Sports & Recreation
- Matthew Wade