"It was a tough day but it's a part of test cricket and hopefully Pakistan will put up a good fight tomorrow," seamer Junaid Khan said.
"Perera batted well, but the wicket is very flat and it has favored the batsmen on the first two days."
Mathews earlier put on 112 runs with Perera in nearly three and a half hours for the seventh wicket before he sliced Khan (3-81) to deep cover just before tea.
Pakistan's spinners toiled hard but neither Saeed Ajmal (2-120) nor Abdul Rehman (1-101) got any turn at Sharjah Cricket Stadium and they both could not add to their Thursday's tally of wickets despite bowling 55 and 50 overs in the innings respectively.
Perera, who came into bat at No. 8 in only the sixth over of the day, batted with maturity in two productive partnerships as he faced 247 balls in a meticulous knock.
After sharing a century-stand with Mathews, Perera upped the scoring rate with Eranga.
Mathews then tested Pakistan openers Khurram Manzoor (14 not out) and Ahmed Shehzad (5 not out) for six overs by declaring late in the day.
Earlier, Mathews, who scored 91, a career-best unbeaten 157 and 42 in his previous three knocks in the series, missed a century after batting for six hours off 256 balls before attempting to slice left-arm seamer Khan over covers but managed only to hole out to Shehzad at deep cover in a rare rash shot.