Kusal Mendis excelled under pressure again, hitting a sparkling 86 and featuring in two important partnerships to help Sri Lanka overcome a shaky start and post 281 all out on the opening day of the second test against Australia on Thursday.
The hosts returned to reduce Australia to 54 for two, with Dilruwan Perera dismissing David Warner (42) with the final delivery of the day.
Usman Khawaja was unbeaten on 11 with Australia trailing by 227 runs.
Paceman Vishwa Fernando made a memorable test debut for Sri Lanka, opening the attack and dismissing Joe Burns for nought with his second delivery.
It was, however, Mendis who hauled the hosts back into the contest after Mitchell Starc's two-wicket burst left them reeling at nine for two inside five overs.
The 21-year-old right-hander added 108 runs with Kusal Perera (49) and 67 with captain Angelo Mathews (54) to steady the innings.
Mendis pulled off a similar rescue act in the first test at Pallekele where Sri Lanka were six for two in their second innings before his career-best 176 helped secure the hosts' 106-run victory against the world's top-ranked test team.
Left-arm paceman Starc (5-44) gave Australia a dream start by dismissing Dimuth Karunaratne for a golden duck after Mathews had won the toss and opted to bat on Galle's spin-friendly track.
Kaushal Silva (five) also fell to an innocuous Starc delivery but Mendis and Perera staged a brilliant recovery, finding boundaries regularly during their century stand.
Spinner Nathan Lyon denied Perera his half-century but runs kept flowing with Mathews dictating terms with clean hitting and decisive footwork against the spinners.
The Sri Lanka captain also unfurled the reverse sweep against Lyon to collect a couple of boundaries.
Starc dismissed Mendis to claim his 100th test wicket, ending the right-hander's 137-ball knock which included 10 fours and two sixes.
Left-arm spinner Jon Holland impressed with his flight and loop on his debut test but had to wait for his first wicket until the final session when he trapped Dhananjaya de Silva (37) lbw with a full toss.