Home captain Dimuth Karunaratne's decision to bat in Galle appeared to have backfired after Shaheen Afridi dealt three blows in the morning session and Sri Lanka slumped to 54-4.
De Silva, 94 not out, and Mathews (64) then forged a 131-run partnership to steady the innings in the first match of the two-Test series.
Mathews fell at the stroke of tea, but De Silva went on to stitch together another 50-plus partnership with Sadeera Samarawickrama, who made 36 before Agha Salman dismissed him with the final delivery of the day.
Earlier on Sunday, Afridi made an emphatic return to Test cricket after Sri Lanka elected to bat at a venue where they have played six of their last eight tests, winning four of them.
Afridi, who suffered a hamstring injury at the same stadium last year, claimed his 100th Test wicket in his second over, having opener Nishan Madushka (4) caught behind.
Rain broke a halt after 5.5 overs but Afridi mowed down Sri Lanka's top order after play resumed as Kusal Mendis (12) perished in the slip and Karunaratne (29) fell caught behind.
Naseem Shah dismissed Dinesh Chandimal (1) before Mathews and de Silva bailed out Sri Lanka.
Abrar Ahmed removed Mathews but de Silva, who hit three sixes and 10 fours in his stellar knock, remained on course for his 10th test hundred.