Angelo Mathews remained unbeaten on 39 and top scored with 56 runs. He was bowled by Shakib Al Hasan after completing his 41st Test half-century.
When the innings was declared, Prabhat Jayasuriya was unbeaten on 28 runs, along with Vishwa Fernando, who was unbeaten on eight runs.
Debutant fast bowler Hasan Mahmood finished with 4-65 for Bangladesh.
Sri Lanka will not have Dinesh Chandimal in the field for the remainder of the game as he has returned home due to a family emergency.
Sri Lanka, which has never lost a Test series to Bangladesh, won the first Test in Sylhet by 328 runs.