Australia were on the verge of a 3-0 series sweep after reducing Sri Lanka to 225 for seven with a slender lead of 87 at close of play on a dramatic third day of the third test on Saturday.
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.
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.
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.
Wade 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.