Wicketkeeper-batsman Niroshan Dickwella, on 42, and debutant Dunith Wellalage, on six, were batting after pace bowler Naseem Shah struck with the second new ball.
Naseem bowled Dhananjaya de Silva for 32 and nearly got Dickwella on 24, but skipper Babar Azam dropped his second catch of the day, this time at second slip.
Left-arm spinner Mohammad Nawaz stood out for Pakistan with the two key wickets of Oshada Fernando, who made 50, and Chandimal.
Chandimal, who made 206 not out, 76 and 94 not out in his previous two Tests, handled the opposition spinners with aplomb until his departure on a pitch that turned on day one.
Mathews started well but failed to capitalise on a reprieve on 36, when Azam dropped an easy catch at extra cover off left-arm spinner Nauman Ali.
Nauman came after the tea break to get Mathews caught behind, with the batsman walking back to a dressing room cheering his Test milestone.
Fernando and skipper Dimuth Karunaratne started with a 92-run opening stand before Nawaz broke through.
Fernando smashed Nawaz for six to reach his seventh Test half-century, but got out caught behind on the next ball.
Kusal Mendis survived 11 balls and made three before being run out at the stroke of lunch off a direct throw from Agha Salman, while the batsman was backing up at the non-strikers’ end.
Karunaratne fell to Yasir Shah’s leg spin after his attempted reverse sweep went to backward point where Naseem took a sharp catch as Sri Lanka looked in trouble at 120-3.
Chandimal took stock with Mathews and then De Silva in a partnership of 63 but a wild slog got him caught at backward point off Nawaz.
Mathews, 35, was feted by Sri Lanka Cricket and accompanied by his family at the start of the Test for reaching his century of five-day matches since his debut at the same venue in 2009, also against Pakistan.