Half-centuries from skipper Steven Smith and Shaun Marsh kept Australia in the hunt after Dinesh Chandimal's ton for Sri Lanka dominated Sunday's play in the third and final Test.
Australia lost opener David Warner early but were 141 without further loss at close of play on the second day in Colombo, trailing the hosts by 214 on first innings.
Dhananjaya de Silva, who scored his maiden Test century on Saturday, struck again with the ball to claim the crucial wicket of Warner for 11.
But Smith, who was on 61 at stumps, soon took charge along with Marsh who finished the day on 64.
The pair used their feet to good effect against the Sri Lankan spinners as they combined the right mix of caution and aggression.
Smith's 108-ball stay was laced with five boundaries and a six. Marsh, who was drafted into the XI for his Asia experience, struck 10 fours.
Australia's pace spearhead Mitchell Starc, who took a five-wicket haul, praised his team's batsmen for playing positively.
"We are one down unfortunately but otherwise how Shaun and Steve played through the last session was great," Starc told reporters.
"Tough to bat last on this wicket with the quality of their spinners... important to get big scores like the two Sri Lankans got in their first innings," Starc said.
Chandimal, who started Sunday on 64, was the hero of the day after his dogged 132 helped Sri Lanka post a challenging first-innings 355.
Chandimal's overnight partner de Silva advanced from 116 to 129 before falling in the first hour, but not before the pair had rescued the innings with a 211-run partnership.
- Starc effect -
Their sixth-wicket stand lifted Sri Lanka, who chose to bat first, from a highly precarious 26 for five to a position of strength.
"It was a tough time before I went to bat... I learnt a lot of things from those last four innings in the first and second game," Chandimal said.
"I tried to face more balls rather than play shots. Finally I succeeded."
Chandimal, who recorded his seventh Test century, put together another crucial 73-run partnership with Rangana Herath, who made a brave 33 before retiring hurt.
The two batted well even after a brief rain spell in the afternoon session, frustrating the Australian bowlers.
Sri Lanka's cause was also helped by some poor fielding by the visitors, with Chandimal and Herath both dropped by Smith.
On the opening day Shaun Marsh had dropped de Silva at short cover when he was on 104.
Starc, who got good support from Nathan Lyon (3-110), returned figures of 5-63, becoming the first Australian bowler to take three five-fors in a series in Sri Lanka.
"All their bowlers bowled well, that is why they are number one. Credit goes to them, they bowled in the right areas, especially on this kind of pitch," Chandimal said of the Australian attack.
Top-ranked Australia, who have already lost the first two Tests, are desperate to salvage some pride.
The hosts, meanwhile, are eager to make history by completing a series whitewash over Australia.