Perera (95) and Mathews made life difficult for Pakistan through their 112-run seventh wicket stand before Sri Lanka declared their first innings at 428-9, leaving Pakistan to score 19-0 in a tricky six overs before the close of the second day's play.
Openers Ahmed Shehzad (five) and Khurram Manzoor (14) survived an anxious time as Pakistan go in search of a big lead to square the series after losing the second Test by nine wickets in Dubai.
Sri Lanka, leading the series 1-0 after the first Test ended in a draw in Abu Dhabi, are aiming to seal the series.
The day once again exposed the flat Sharjah stadium pitch as Mathews put 73 for the sixth wicket with Prasanna Jayawardene (35) and then batted solidly with Perera, leaving Pakistani bowlers frustrated and failing in their search for quick wickets.
The 31-year-old Perera, who made his one-day debut in 2007 but had never played a Test before, looked more solid during his 305-minute batting as he drove and pulled with perfection before hooking paceman Mohammad Talha into the hands of deep fine-leg.
He hit 12 boundaries and two sixes and added an invaluable 72 for the ninth wicket with Shaminda Eranga (25 not out).
Perera said: "I am really happy to score 95, sad to miss the hundred but it's still an achievement considering Pakistan had two of the best spinners in the world," said Perera, whose 95 is the highest overseas score by a Sri Lankan on his debut.


Latest News from Sports News Desk