The right-hander, who faced 95 balls, was initially given not out on a caught-behind appeal before Bangladesh successfully reviewed.
Mathews, who smashed four fours and a six, was batting with Dinesh Chandimal on 10 at stumps.
Bangladesh made early inroads after Sri Lanka resumed on 143-2, Ebadot Hossain bowling nightwatchman Kasun Rajitha for a duck with the second ball of the day.
"I thought today Ebadot was fantastic. I thought he ran in all day long. I told him after tea to ask for the ball. He did that and caused problems," said Bangladesh pace bowling coach Allan Donald.
The former South African great also praised the Sri Lankan pacers for the impact they created on the opening day by reducing Bangladesh to 24-5 in a chaotic first hour.
"I thought the Sri Lanka quicks on day one were awesome in terms of their consistency and asking questions," said Donald.
"They got the ball to swing. They hit the areas. I said that on these wickets in Bangladesh, your new ball is massive.
"They exploited that really well."
A gem of a delivery from Shakib dismissed Dimuth Karunaratne for 80 soon after Rajith went, with the Sri Lankan skipper adding 10 to his overnight score.
Shakib tossed the ball up on off-stump and Karunatne went for a drive but saw the flighted delivery dip and turn between bat and pad before crashing into his stumps.
Karunaratne, who was dropped on 37, struck nine boundaries in his 15th Test fifty.