Australia faced a daunting task to claim victory in the first Test as Sri Lanka's spinners continued to prosper on a day hampered again by poor light.
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 rugged challenge to win, for history has shown they have only once in 13 attempts successfully chased more than 200 on the sub-continent, that being against Bangladesh in Dhaka in 2006. 
That challenge only grew when bad light forced another delay close to tea, with the tourists 3-83, needing another 185 to win. Skipper Steve Smith was unbeaten on 26 and Adam Voges, again having survived an lbw review before he had scored, nine not out.
David Warner, though, was not so fortunate, when he 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.
Warner's combined return of one run was the worst performance by an Australian opener since Mark Taylor made a pair on his captaincy debut against Pakistan in Karachi in 1994.
When Usman Khawaja also fell cheaply, for the second time this match lbw, Australia was 2-33.
Khawaja had appeared at ease in his brief stay but that changed when he opted to sweep a fullish delivery from off-spinner Dilruwan Perera, mistimed the stroke and was hit on the back leg.
It was also a case of groundhog day for Joe Burns, who again was bowled. He, too, had been compact, and had even stepped down the pitch and clipped a straight six off Herath. But his frailties against slow bowling, representative of Australia's batting to that point, was exposed when Lakshan Sandakan, the left-arm wrist-spinning hero with the ball earlier in the match, delivered a ripping leg-spinner. Burns had shaped to cut, only for the delivery to turn viciously, leading to him playing on to his stumps.
Kusal Mendis, the star of Thursday, 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 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, 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.


SCOREBOARD
SRI LANKA: 1st innings 117, AUSTRALIA: 1st innings 203
SRI LANKA: 2nd innings                               R           M B 4s 6s
K Perera lbw Starc                                        4      10 5 0 0
K Silva lbw O'Keefe                                       7         59 32 0 0
D Karunaratne lbw Starc                               0        2 3 0 0
K Mendis c Nevill b Starc                               176 319 254 21 1
A Mathews c Burns b Lyon                            9      54 31 0 0
D Chandimal lbw Marsh                                42  117 100 4 0
D de Silva c Khawaja b Lyon                         36  80 62 3 0
D Perera lbw Hazlewood                                12  51 22 2 0
R Herath c (sub) Henriques b Hazlewood       35  60 34 6 0
L Sandakan b Starc                                       9   6 7 2 0
N Pradeep not out                                         10 21 12 2 0
Sundries (1b, 12lb)                                       13
TOTAL:                                                         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 minutes. OVERS: 93.4.
AUSTRALIA: 2nd innings                             R M B 4s 6s
J Burns b Sandakan                                    29 62 57 2 1
D Warner b Herath                                     1 5 4 0 0
U Khawaja lbw D Perera                              18 23 22 3 0
S Smith not out                                          26 63 54 3 0
A Voges not out                                          9 30 25 1 0
Sundries                                                     0
TOTAL (for three wickets)                           83
FALL: 2 (Warner), 33 (Khawaja), 63 (Burns). BOWLING: N Pradeep 3-0-16-0, R Herath 10-1-35-1, D Perera 9-1-19-1, L Sandakan 5-1-13-1. BATTING TIME: 93 minutes. OVERS: 27.
AT STUMPS, DAY FOUR