Australia lost three early wickets to Sri Lanka's spinners before skipper Steve Smith steadied the ship as the visitors struggled to chase down a formidable target of 268 in a nail-biting first Test.
Australia were precariously placed at 83 for three, with Smith unbeaten on 26, when bad light forced the umpires to call tea early on the fourth day in Pallekele in a match that has already been badly hit by rain.
Australia still need another 185 runs for victory to take a lead in the three-match series.
Rangana Herath struck early with his left-arm spin when the veteran bowled David Warner for one. Offspinner Dilruwan Perera then soon had Usman Khawaja trapped lbw with the score reading 33/2.
Debutant spinner Lakshan Sandakan, who bagged four wickets in the first innings, cleaned up opener Joe Burns who had looked well set on 29 until he chopped a turning ball onto his stumps.
Smith then began a battling 54-ball innings, which has so far not seen him score any boundaries. His partner Adam Voges was similarly steadfast as the Australians looked to consolidate their status as the number one Test team.
Earlier it was Kusal Mendis' superb maiden century of 176 that helped Sri Lanka seize control of proceedings after lagging behind for three full days in a match shortened by several rain interruptions.
Herath combined with Nuwan Pradeep for a 30-run last wicket stand to push Sri Lanka's lead past 250. With a target of 268, Australia face an uphill task to save the Test. They have only chased down a target of over 250-plus once in the last 10 years.
Sri Lanka, starting Friday on 282 for six, managed 353 in their second innings to turn things in their favour against Australia
Smith's team, who were crowned the World No.1 in Tests, have had an abysmal record in the sub-continent in the last couple of years. They lost 0-4 to India in 2013 while they suffered a 2-0 whitewash against Pakistan in the UAE. Their travails against spin continued with Lakshan Sandakan and Rangana Herath picking up four wickets each in the first innings
Brief Scores:
Sri Lanka 117 and 353 all out in 93.4 overs (Kusal Mendis 176, Dinesh Chandimal 42; Mitchell Starc 4-84)
Australia 203 and 83/3 in 27 overs (Steven Smith 26 not out; Rangana Herath 1-35, Laskhan Sandakan 1-13)