Mustafizur Rahman and Shakib Al Hasan shared six wickets between them but Sri Lanka fought back through a fighting century from Dimuth Karunaratne in the second Test in Colombo on Saturday.
Karunaratne held down one end to score 126 before a dogged unbeaten innings by Dilruwan Perera helped Sri Lanka reach 8-268 at stumps on the fourth day to stretch their lead over the visitors to 139 runs.
Quick single: Photo debunks alleged Smith controversy
This lead looked unlikely once Mustafizur and Shakib triggered a collapse in the Sri Lankan innings in the post-lunch session but Karunaratne hung on to score 126 before Perera hit an undefeated 26 off 126 balls.
Perera received support from tail-enders Rangana Herath (9 off 32 balls) and Suranga Lakmal, 16 not out.
Bangladesh struck in the day's second over through off-spinner Mehedi Hasan, who spun one sharply to bowl opener Upul Tharanga for 26 after Sri Lanka resumed on 0-54.
But Karunaratne and Kusal Mendis shared an 86-run stand for the second wicket to help the hosts wipe out their first innings deficit.
"I think the wicket is really good. We lost a few wickets and after that we could not capitalise," said Karunaratne.
"Three of our main batsmen got out in one phase. At the end of the day we have to stay positive. We just wanted to play our normal game," he said.
"If we can get 200-plus (lead), it's a good score. We are happy if they can bat till we get 200 or more."
Mustafizur helped Bangladesh bounce back in the contest with quick strikes in his second spell as Mendis edged a ball outside the off-stump to wicketkeeper Mushfiqur Rahim for 36.
Five overs later it was the turn of first-innings centurion Dinesh Chandimal, who played a loose drive to be caught behind for five.
Asela Gunaratne was adjudged leg-before for seven off Shakib without offering a shot before Mustafizur struck again to dismiss Dhananjaya de Silva for a duck.
Niroshan Dickwella survived a close call for lbw but could not make use of it giving Mushfiqur his fourth catch down the leg-side off Shakib to depart for five.
Quick single: 'Big Four' a fearsome Ashes prospect
An edge off Mustafizur flew to the third man boundary to earn Karunaratne his fifth Test century but he fell in the final session edging Shakib to Soumya Sarkar at slip.
Taijul Islam removed Herath but Bangladesh were yet to find a way past Perera’s ultra-defensive batting.
Mustafizur claimed 3-52 for Bangladesh while Shakib finished the day with 3-61.