Australia have enjoyed their best batting session of the series with Sri Lanka as they fight their way back into the third Test in Colombo.
At stumps on Sunday, the tourists are 1-141 in reply to the home side's gritty first-innings 355 to leave the match fairly evenly poised after two days.
Shaun Marsh justified the selectors' decision to pick him in place of Joe Burns at the top of the order, providing patience and stability in his 64 not out.
Skipper Steve Smith was back to his industrious best and is unbeaten on 61.
In the first innings of the last Test in Galle, Australia were bowled out inside 34 overs.
At Sinhalese Sports Club they were much more assured on an even drier wicket that was expected to be perfectly suited to the hosts' three spinners.
Marsh and Smith's partnership is worth 120 and easily surpassed the previous highest Australian partnership of the series, which was 60 between Adam Voges and Mitch Marsh in Kandy.
It was just what Australia needed following the heavy second-Test defeat and especially after losing David Warner in the fourth over.
Warner's frantic nine-ball stay at the crease was in stark contrast with Dinesh Chandimal, whose classy 132 came from 356 balls in just under eight hours.
His 211-run partnership with Dhananjaya de Silva (129) was the prime reason Sri Lanka posted their formidable total after they came together with the hosts in deep strife at 5-26.
Veteran spinner Rangana Herath, who retired hurt on 33 after getting hit in the groin from a Josh Hazlewood delivery, returned to the field after tea and while he made a few deliveries grip and spin, he was well handled by Marsh and Smith.
De Silva's dig came to an end when he was caught at bat-pad off the bowling of Nathan Lyon (3-110) midway through the opening session.
Chandimal was a bit more watchful but picked off the Australian bowlers to advance to his sixth Test century.
He was out when wicketkeeper Peter Nevill took a sharp catch off Mitchell Starc, who was once again Australia's best bowler with 5-63.
Starc became the first fast bowler to take three five-wicket bags in a Test series in Sri Lanka.
Dilruwan Perera was dismissed when Jon Holland (1-69) had the allrounder caught by spin partner Lyon at long off.
The Victorian should have accounted for Chandimal a few balls after he brought up his century, but Steve Smith couldn't hold on to the low chance to his left at first slip.
It was one of four dropped chances by Australia, including two uncharacteristically put down by the captain.