Sri Lanka were five wickets away from a series win against Bangladesh after the tourists were restricted to 177 for five at stumps on day four of the second Test at Pallekele on Sunday.
Chasing a daunting 437 to win, Bangladesh batsmen were troubled by Sri Lanka spinners Praveen Jayawickrama and Ramesh Mendis who took the five wickets on a crumbling wicket.
Sri Lanka set Bangladesh a formidable target of 437 by declaring their second innings on 194 for nine at the hill city of Pallekele. No team has reached such a large target in Test history.
The greatest run chase in the history of Test cricket is the 418 made by the West Indies against Australia in 2003 in Antigua.
The most successful run chase at Pallekele, a picturesque hill resort, is 382 by Pakistan in 2015.
Should Bangladesh succeed in forcing a draw with 150 overs left in the game, Sri Lanka risk falling to their lowest world ranking.
Bangladesh, who are down to their last recognised pair, need another 260 runs to win with one full day's play left.
Najmul Shanto, who scored 26 in the second innings after his duck in the first, regretted their performance in the first innings when they were bundled out for 251.
"I think we should have batted better in the first innings," Shanto told reporters after the fourth day's play.
He said they could not maintain good partnerships like the 63 for the fourth wicket.
"We couldn't put together any more partnerships, which set us back."
Sri Lanka declared their second innings after lunch on 194 for nine and Bangladesh lost three wickets in the afternoon session finishing on 111 for three at tea.
Mendis claimed the big wicket of Tamim Iqbal when he was caught behind by Niroshan Dickwella for 24. Debutante Jayawickrama, who took six wickets in the first innings, accounted for Saif Hassan and Najmul Shanto.
The delivery that dismissed Shanto pitched outside off stump, spun sharply, went through bat and pad and hit the top of leg-stump.
After tea, Bangladesh lost captain Mominul Haque, who chopped a Mendis delivery onto his stumps to leave his side struggling at 134 for four.
Mendis said it would be hard work although they had one full day to take five wickets.
"We need to do the basics right," Mendis said. "It is going to be hard work. There could be a bit of pressure because we have exhausted our reviews."
Earlier, Dimuth Karunaratne top scored with 66 runs as Sri Lanka declared on 194 for nine. The Sri Lankan captain finished the series with 428 runs in three innings, having scored a double hundred, a hundred and a half-century.
Bangladesh's left-arm spinner Taijul Islam bagged his eighth five-wicket haul, for 72.
The first Test ended in a draw after a festival of runs, the two sides scoring 1,289 for the loss of just 17 wickets over the five days.