Sri Lanka reached 282-5, lowering the first innings deficit to 83 before the bad light brought a premature end to the day.
Bangladesh was bowled out for 365 with Mushfiqur Rahim unbeaten on 175 and Liton Das scoring 141.
Showers, however, washed out the post-lunch session.
Angelo Mathews, who scored 199 in the first test, was batting on 58 with Dinesh Chandimal on 10.
“The target is to take a lead first and then make it bigger,” Sri Lanka coach Navid Nawaz said. “We’ve got two experienced batters in the wicket at this moment and hopefully they will be successful to execute the plan. I think still it is possible to win the game from this situation.”
Sri Lanka captain Dimuth Karunaratne hit 80 from 155 balls with nine fours. Dhananjaya de Silva made 58.
Sri Lanka resumed on 143-2 but lost nightwatchman Kasun Rajitha with the second delivery of the day when paceman Ebadot Hossain (2-78) bowled him with an express delivery.
Left-arm spinner Shakib Al Hasan, who returned figures of 3-59, rattled the stump of Karunaratne, spinning a delivery sharply past his bat as Sri Lanka slipped to 164-5.
“He (Shakib) is a smart operator. He changes his pace really subtly. He showed again, chipped away,” Bangladesh pace bowling coach Alan Donald said. “Hopefully he walks away with a five-wicket haul tomorrow. It is awesome to have him in the team. His experience and leadership is priceless.”
Mathews and de Silva steadied the innings as Bangladesh sensed a chance to put them on top. De Silva cut paceman Khaled Ahmed past point for a boundary to raise his 10th fifty off 90 balls.
But Shakib reviewed a decision successfully soon after to dismiss him for 58, brining an end to the 102-run partnership.
Mathews, who played defensively throughout the day, raised his 38th half-century from 125 balls.