The home side started day three 294 for six and managed to get to 346 before they were bowled out. Bangladesh were 23 without loss at lunch, but having made only 240 in their first innings, were still 83 runs behind.
Dinesh Chandimal and captain Kumar Sangakarra both completed centuries on day two as the hosts recovered from 69 for four to put themselves in a position to go one up in the two-match series.
Nuwan Kulasekara and Sangakarra made a slow start to the third day, with a boundary by the former in the fifth over taking him to five from 40 balls.
Their chances of moving their score along at pace were disrupted by the captain's dismissal with the last ball of the 99th over, caught by wicketkeeper Mushfiqur Rahim off Abul Hasan for 139.
Rangana Herath lasted just five balls before he was bowled between bat and pad by Sohag Gazi for three.
Sohag was given the treatment by Shaminda Eranga, who hit him for two boundaries in the 109th over, before Kulasekara edged one to Rahim off Sohag for a 75-ball 22.
Eranga was the last wicket to fall for 15, caught by Mohammad Ashraful off Mahmudullah for 15.
Tamim Iqbal (23 not out) and Jahurul Islam (nine not out) ensured the visitors had all 10 wickets in tact at the break.