Veteran spinner Rangana Herath took six wickets to help Sri Lanka dismiss Australia for 379 in the first innings on the third day of the final Test in Colombo Monday.
Australia, whose total was anchored on a massive 246-run partnership between skipper Steve Smith and Shaun Marsh, finished with a slender 24-run lead in response to Sri Lanka's first innings total of 355.
Unbeaten centuries from Shaun Marsh and skipper Steven Smith powered Australia to 235 for one at lunch.
Smith and Marsh put together an unbroken 214-run partnership for the second wicket to strengthen Australia's first innings reply against Sri Lanka's 355.
The left-handed Marsh, whose innings was laced with 16 boundaries, was on 110 while Smith, who has hit nine boundaries and a six, was on 104 at the break.
Marsh, who started the day on 64, recorded his fourth Test century and second in Sri Lanka.
The opener, who was drafted into the Australia side because of his long experience of Asian conditions, survived a dropped catch on 67 early in the morning against Rangana Herath but soon took control.
He brought up his hundred with an inside edge off Dilruwan Perera that went for a boundary and he celebrated the milestone by hugging his skipper at the other end.
Smith, who resumed the day on 61, soon got his 15th Test century to improve on his previous best of 55 in the series.
Smith and Marsh used their feet to good effect to blunt the spinners, forcing Sri Lankan skipper Angelo Mathews to keep rotating his bowling options at the Sinhalese Sports Club.
For Sri Lanka, Dinesh Chandimal and Dhananjaya de Silva had completed superb centuries on the second day to lift the hosts from a precarious 26 for five to a respectable total.
Chandimal, who scored 132 and De Silva, who scored his maiden test ton, put together a remarkable fightback with a 211-run sixth wicket partnership.
Australian pace spearhead Mitchell Starc took five wickets with support from off-spinner Nathan Lyon who got two.
Top-ranked Australia are bidding to avoid a series whitewash after losing the first two Tests.