Sri Lanka 215 (Karunaratne 59, Starc 5-54) and 0 for 17 need 499 more runs to beat Australia 5 for 534 dec and 3 for 196 dec (Khawaja 101*, Head 59*)
A five-wicket haul from Mitchell Starc set up a 319-run first-innings lead for Australia, before Usman Khawaja's flowing second-innings ton set Sri Lanka 516 for victory - the hosts ending the day 10 wickets away from a 2-0 series win.
Both Australia's stars on the third day were short of confidence after tough summers, and a depleted Sri Lanka were a perfect side to rebound against. Starc routinely breached speeds of 150kph to deliver perhaps the most fearsome spells of the series so far, to claim his first five-for since March last year.
Khawaja, meanwhile, had hit only one fifty in his 10 most-recent innings, and had to battle through a tough period against Dilruwan Perera, before finding his feet after tea. Captain Tim Paine seemed to have delayed the declaration specifically to allow Khawaja to reach triple figures, which he did off the 134th ball he faced. This meant that Australia only had six overs at the Sri Lanka openers before the light deteriorated, however. Dimuth Karunaratne and Lahiru Thirimanne survived unscathed.
Despite that, it was a thoroughly woeful day for Sri Lanka, in a tour that has been awful on various fronts. Either side of lunch, they lost 6 wickets for 45 - Starc precipitating that collapse by claiming two wickets in one over, before completing it by blasting out the tail. More worrying even than the batting slump was the blow to Kusal Perera early in the day. Hit flush on the side of the helmet by a Jhye Richardson bouncer, Perera left the field a little unsteady in the next over. According to Sri Lanka's manager, he suffered a mild concussion. He didn't take the field for the remainder of the day, but they are hopeful he may be in a state to bat on day four.
It had been the injury to Kusal that had unsettled Sri Lanka. Early in the day, Kusal and Dhananjaya de Silva - the overnight batsmen - had made bright starts as Australia's bowlers largely pitched the ball up, looking for swing. With no movement on offer, Australia began to bowl more short deliveries, and it was then that Sri Lanka ran into trouble. Kusal essentially ducked into that bouncer Richardson, the force of the blow near the right ear causing one part of his helmet to disintegrate, and another part to fly off.
Dimuth, who had been struck in the neck the previous evening and had been cleared to bat by doctors overnight, could add only 13 runs to his score before he was out sending a catch off Starc to gully. Earlier in that same over, de Silva had attempted to hook a Starc bouncer, and ended up knocking off his own off bail, unable to control the swing of his bat.
Spinners Nathan Lyon and Marnus Labuschagne then removed Chamika Karunaratne and Niroshan Dickwella respectively - the former going for a duck on debut, and the latter being given somewhat controversially, after the third umpire failed to overturn an lbw in which Dickwella had appeared to glove the ball before it struck pad. But by this stage, Australia had already made the vital blows and were all over Sri Lanka, who were clearly rattled.
Soon after lunch, Starc dismissed Dilruwan and Vishwa Fernando in the space of three balls to wipe out the Sri Lanka tail - Australia declining to enforce the follow-on as expected, because their bowlers had already delivered 68.3 overs in the first innings.
Sri Lanka's seamers did impress with the new ball, having Australia 3 for 37 at one stage - Kusal Mendis taking two more excellent catches at second slip - but as in the first innings, they were virtually toothless when the ball lost its shine. Khawaja was tense early in his innings, particularly against Dilruwan, who has a history of getting him out. But having survived until tea on 25, he blossomed in the third session, hitting beautifully through the covers, as well as through point and square leg, whenever Sri Lanka pitched short. He hit 14 fours in his 101 off 136 deliveries, and in the process, put on a 159-run stand with Travis Head, who made a half-century to go with his 161 in the first innings.
Paine eventually declared after Khawaja had got to his hundred (it's worth remembering that Paine had denied himself a half-century by declaring when he was on 45 in the first-dig), and his quicks, though menacing, could not break through before the umpires deemed the light unfit for play. Dimuth and Lahiru Thirimanne both ended the day on 8 not out.
Andrew Fidel Fernando is ESPNcricinfo's Sri Lanka correspondent. @afidelf