Shakib Al Hasan turned the game on its head with two quick wickets in the afternoon session but Bangladesh's inability to break through the defences of Vishwa Fernando and Angelo Mathews saw Sri Lanka inch closer to a first-innings total of 400. At tea on day two, they were 375 for eight.
Sri Lanka started the day with an overnight score of 258 for four. Angelo Mathews, unbeaten overnight on 114, could have been dismissed in the fourth over of the second day but no one heard a sound as the ball took the outside edge of his bat and went to the keeper off Khaled Ahmed.
Mathews got a reprieve on day one as well as Taijul Islam induced the outside edge but Mahmudul Hasan Joy at slip was standing a bit too wide to catch it. Earlier, he survived a caught behind call too.
Chandimal, on the other hand, was steady and brought up his 21st Test half century off 128 deliveries. He played a few shots after a fifty which included a four and six off Taijul in the same over.
But Nayeem Hasan got his third wicket by removing Chandimal (66) who attempted a reverse-sweep and was trapped in front. The off-spinner broke a 136-run stand between Chandimal and Mathews.
One brought two for Nayeem as he knocked over Niroshan Dickwella in the same over to bring Bangladesh back into the contest.
Sri Lanka added 69 to their overnight total and were 327 for six at lunch on day two.
Bangladesh started the afternoon session in the best way possible. Shakib Al Hasan's perseverance throughout day one and first session of day two paid off as he removed Ramesh Mendis and Lasith Embuldeniya in consecutive deliveries.
But Vishwa Fernando, the Sri Lanka number ten, proved a tough customer as he showed excellent defensive technique and stuck together with Mathews for 140 deliveries before the tea break.
Vishwa could have got out just before tea had Mushfiqur Rahim not dropped a regulation catch at mid-on. However, the duo added an unbroken 47 and frustrated the bowlers. Mathews was 22 away from a well-deserved double hundred.