Sri Lanka, who are pushing for a rare series whitewash after winning the first two Tests, were 312 for eight at stumps on the fourth day at the Sinhalese Sports Club.
First innings centurion Dhananjaya de Silva was unbeaten on 44 with Suranga Lakmal yet to get off the mark at close of play.
But the day belonged to Silva, who batted with six stitches on the webbing of his little finger after injuring himself while fielding on Monday to make a composed 115.
Silva, who regularly received treatment for his injured left finger during breaks, reached his century with a boundary off Adam Voges as he burst into a celebration.
More From This Section
Off-spinner Nathan Lyon, who claimed four wickets, trapped Chandimal lbw for 43 in the final session to break the stand.
Silva, who survived an lbw appeal against Lyon after a successful umpire review in the first session, finally fell to the left-arm spin of Jon Holland in the 87th over.
Earlier Australia benefited from a review after Holland had Kusal Perera caught off a top edge which took the pads and went into the gloves of the wicketkeeper.
Perera, who scored 24, was undone by a side angle replay after a front-on view had been inconclusive and the third umpire overturned the decision.
Kusal Mendis hit a quickfire 18 off 14 balls with two sixes and a four. But his counter-attack was halted when he was trapped lbw by Mitchell Starc, who has taken two wickets.
Centuries from skipper Steve Smith and Shaun Marsh had given Australia hope of a big first-innings lead on Monday, but their departure saw the visitors lose their last seven wickets for 104 runs.
Veteran spinner Rangana Herath led the Sri Lankan attack, snaring six wickets, with Australia all out for 379 in response to Sri Lanka's 355.
Sri Lanka now have the chance to register their first whitewash against a major team since gaining Test status in 1981.