A stunning century by emerging Sri Lankan strokemaker Kusal Mendis ended early on day four but Australia still faced a daunting task if they were to claim victory in the first Test.
Resuming with a lead of 196 and four wickets in hand, the hosts pushed that advantage to 267 before they were dismissed for 353 after lunch at the Pallekele Stadium. The tourists faced a potentially rugged challenge to win, for history has shown they have only once successfully chased more than 200 on the sub-continent, that being against Bangladesh in Dhaka in 2006.
That challenge only grew when, in the second over, David Warner stepped down the wicket to left-arm spinner Rangana Herath and was bowled, having played over the top of the delivery. It completed a miserable match for the Australian vice-captain, who was dismissed for a duck in the first innings, having only recently proven he had recovered from a broken finger. 
The silky Mendis began the day unbeaten on 169 but he had managed only seven more runs when he prodded at a wide delivery from intimidating paceman Mitch Starc and feathered an edge to gloveman Peter Nevill. Australia had wanted to take the second new ball late on Thursday but was denied this when Mendis and Dilruwan Perera accepted an offer from the umpires to leave because of poor light.
The tourists have been destructive with the new ball through this match, and so it proved when Mendis' fine knock came to an end - but not before he had posted the highest-ever Test score on this ground. It was also the second-highest knock by a Sri Lankan against Australia, falling just short of Kumar Sangakkara's 192 in Hobart almost nine years ago.
The son of a three-wheeler driver in Colombo, and with only one first-class ton to his name before this match-turning conquest, Mendis appears set to be a long-term plank of Sri Lanka's rebuild.
Mendis was hailed on Friday as the next-generation Mahela Jayawardene, the former champion Sri Lankan captain, by another local great, Aravinda de Silva.
Jayawardene, for his part, had said on social media that the hosts needed to add 75 more runs to their overnight score "to win this Test". They would add 71.
Having torpedoed the hosts for 117 on the opening day, a loss here would be a major psychological blow for the Australians, who had enjoyed an extended warm-up for this series. Their own poor first-innings let the hosts back into the game, and they capitalised. With a spin-friendly wicket of Galle awaiting next week, followed by what typically is a flat deck in Colombo, Australia faces a major fight to improve their recent poor record on the sub-continent.
It was a delayed start to the day because of the threat of rain and, when play finally began, it lasted only 50 minutes before rain fell.
Australia's frustration had been exacerbated when what looked to be their second wicket of the day - when umpire Richard Kettleborough upheld Josh Hazlewood's lbw appeal against Herath - was overturned.
Meanwhile, injured Australian left-arm spinner Steve O'Keefe will return home from Sri Lanka and has been replaced by counterpart Jon Holland. O'Keefe was forced out of the attack because of a hamstring strain while bowling his 17th over on day three of the first Test at the Pallekele Stadium.
Holland, 29, finished the first-class season strongly for Sheffield Shield champions Victoria, and had only recently been drafted into the Australia A squad as a replacement for the injured Ashton Agar.
smh.com.au For a full wrap-up of day four of the first Test


SCOREBOARD FIRST TEST
SRI LANKA v AUSTRALIA
At Pallekelle Innings break, day four
Sri Lanka 1st innings 117
Australia 1st innings 203
SRI LANKA 2nd innings
Batsman  Runs Balls
K PERERA  lbw Starc   4   5
K SILVA  lbw O'Keefe   7   32
D KARUNARATNE  lbw Starc   0   3
K MENDIS  c Nevill b Starc   176   254
A MATHEWS  c Burns b Lyon   9   31
D CHANDIMAL  lbw Marsh   42   100
D DE SILVA  c Khawaja b Lyon   36   62
D PERERA  lbw Hazlewood   12   22
R HERATH  c (sub) b Hazlewood   35   34
L SANDAKAN  b Starc   9   7
N PRADEEP  not out   10   12
Sundries  (1b 12lb)  13
Total All out  353
Fall: 6 (K Perera), 6 (Karunaratne), 45 (Silva), 86 (Mathews), 203 (Chandimal), 274 (de Silva), 290 (Mendis), 314 (D Perera), 323 (Sandakan), 353 (Herath).
Bowling:M Starc 19-4-84-4, J Hazlewood 18.4-3-59-2, S O'Keefe 16.2-3-42-1, N Lyon 27-2-108-2, D Warner 1-0-10-0, A Voges 1.4-0-3-0, M Marsh 9-1-33-1, S Smith 1-0-1-0.
Batting time: 399 minsOvers: 93.4
Umpires: Richard Kettleborough (ENG), S Ravi (IND).
Match referee: Chris Broad (ENG)
Third umpire: Chris Gaffaney (NZL)