Bangladesh will need two quick wickets early on day five to boost their hopes of recording a maiden Test victory over Sri Lanka after Dimuth Karunaratne's heroics gave the hosts a fighting chance of avoiding defeat.
Sri Lanka, who hold a 1-0 lead in the two-match series, will resume on 268-8 in Colombo on Sunday, leading by 139 runs and aiming to avoid a first loss in what is their 18th meeting with the Tigers in the longest format.
Dilruwan Perera (26 not out) and Suranga Lakmal (16no) will be charged with staying at the crease for as long as possible, the latter having survived a last-ball lbw review off the bowling of Mosaddek Hossain after initially starting to walk.
Karunaratne, dropped by wicketkeeper Mushfiqur Rahim late on day three, had resumed on 23 and crafted a brilliant individual century of 126 on Saturday, despite receiving little help from Sri Lanka's other specialists.
One six and 10 fours helped to bring up a fifth Test ton for the 28-year-old, but it may not be enough to save the hosts from an unprecedented defeat.
Shakib Al Hasan (3-61) was the man to end Karunaratne's resistance, a straighter delivery with the new ball gleaning an edge taken by Soumya Sarkar at first slip.
Opening partner Upul Tharanga (26) was bowled by Mehedi Hasan (1-67) with the first ball of the day, sharp turn beating the outside edge to remove off-stump.
Kusal Mendis (36) at number three fared better than his successors, putting on 86 for the second wicket alongside Karunaratne before falling victim to Mustafizur Rahman (3-52), whose straightening delivery drew an edge taken by Bangladesh skipper Mushfiqur.
Sundaram Ravi was not convinced but third umpire Marais Erasmus overturned the on-field decision.
Mustafizur also accounted for Dinesh Chandimal (5) and Dhananjaya de Silva (0) in a similar manner, Mushfiqur obliging behind the stumps after both batsmen chased wide balls.
Asela Gunaratne (7) was trapped lbw by Shakib, who also claimed the scalp of Niroshan Dickwella (5).
A review failed to save Sri Lanka captain Rangana Herath, who on Friday claimed his 1,000th first-class wicket, from being removed lbw by Taijul Islam (1-31), leaving the hosts battling to retain their unbeaten status against the subcontinent's relative minnows.