Australia were eight wickets and Sri Lanka a more improbable 328 runs away from victory in the first Hobart Test after a see-sawing fourth day on Monday.
Sri Lanka bowled out Australia for 278 with star spinner Rangana Herath taking five wickets, leaving them with 393 runs to win at tea. They went to stumps on 65 for two with a day to play.
Kumar Sangakkara and skipper Mahela Jayawardene dug in until close of play. Sangakkara's 18 came off 88 balls and Jayawardene (5) took 25 balls to get off the mark.
The tourists will have to improve on Australia's highest successful run chase at the Bellerive Oval of 369 against Pakistan in 1999.
Sri Lanka's most successful run chase was 352 to beat South Africa by one wicket in Colombo in 2006.
Captain Michael Clarke added to Australia's mounting injury woes when he tweaked his right hamstring and was forced to retire hurt on 57 after reeling off his fastest Test half-century.
Clarke's setback followed paceman Ben Hilfenhaus's side strain which has prevented him from bowling again in the Test, even though he did bat in the second innings.
"Surely in 90-odd overs there are eight balls that have got wickets on them," said Australia coach Mickey Arthur.
"I think the wicket is playing a little more deceptively now. I've got full confidence that weve got an attack that has ability to get those eight wickets tomorrow."
Australia began well, snaring the key wicket of first-innings centurion Tillakaratne Dilshan cheaply for 11 in the 10th over.
Dilshan, who turned around his team's faltering first innings with a knock of 147, was caught behind off Shane Watson's first delivery.
Clarke, fielding at slip with his movement limited by his sore hamstring, gave Sangakkara a life on three when he dropped him off spinner Nathan Lyon.
Mitchell Starc yorked opener Dimuth Karunaratne for 30, hitting off-stump in the 24th over to leave the tourists on 47 for two.
"If we can bat through tomorrow's first session without losing a wicket, it's going to be a good game," Herath said.
"It's just an up-and-down track, a good track. It's going to be an interesting day."
Australia had collapsed, losing the last eight wickets in their second innings for 146 after openers David Warner (68) and Ed Cowan (56) put on 132.
Left-arm spinner Herath captured five for 95 to lead the tourists' counter-attack and now has 60 wickets for the calendar year.
"That's a good achievement," Herath said. "I'm really happy with the way I bowled all day."
The home side had gone to lunch on a still-comfortable 146 for two before their innings unravelled in the middle session as they chased quick runs.
Shane Watson was out three overs after lunch, losing a stumping referral off Herath for five. He was soon followed by Phil Hughes, who chopped Shaminda Eranga onto his stumps for 16.
Matthew Wade, up the order, hit 11 before he holed out to Nuwan Kulasekara at long on off Herath.
Clarke went after the runs and reached his fastest Test half-century off 43 balls, but then called for the team physio and retired hurt.
The wickets kept tumbling and Peter Siddle was brilliantly snapped up by a diving Prasanna Jayawardene off Chanaka Welegedara for four.
Starc hit five before he was leg before wicket to Welegedara and the last able-bodied Australian player Nathan Lyon added 11.
Hilfenhaus, inconvenienced by a side strain, lasted eight balls before he became Herath's fifth wicket when lbw for a duck.
The afternoon clatter of wickets was in sharp contrast to the extended morning session when Warner and Cowan were largely untroubled.
Warner turned on the fireworks to slog Herath for six over long-on and then cheekily switch-hit the left-arm spinner for four.
But in attempting to cut Herath he feathered a catch to wicketkeeper Jayawardene on 68.
Cowan was bowled off-stump by Welegedara for 56 with one that cut back in.