Mushfiqur Rahim (53*) and Litton Das (54*) were at the crease as the hosts ended Tuesday’s game at Zahur Ahmed Chowdhury Stadium at 318 for 3, trailing Sri Lanka by 79 runs.
Tamim and his opening partner Mahmudul Hasan Joy (58) put on 162 runs before the latter was caught down the leg side attempting to glance Asitha Fernando.
Concussion substitute Kasun Rajitha then struck twice, taking the wickets of Najmul Hossain Shanto and captain Mominul Haque and putting pressure on the home side.
Tamim, struggling with cramps during the second session, did not come out to bat after Tea, with Bangladesh on 212 for 3.
Mushfiqur, who had added 36 with Tamim, got good support from Litton as they scored at a steady rate.
Earlier, Nayeem Hasan’s career-best six-wicket haul wrapped up Sri Lanka for 397. The visitors’ innings ended in heartbreak as Angelo Mathews fell on 199 after carrying them to the score.