Sri Lanka were bowled out for 214 in their second innings, with left-arm spinner Abdul Rehman finishing with 4-56 and off-spinner Saeed Ajmal taking 3-53, but not before their batsmen had kept Pakistan at bay on the morning of the fifth and final day.
Prasanna Jayawardene made 49 and held on almost to the end, forcing a 15-minute delay in the lunch break.
Sri Lanka batted positively to add a quick 56 runs in the first hour with Angelo Mathews (31) and Prasanna negotiating the pace-cum spin attack without problems, raising hopes of a declaration after lunch.
Rehman then grabbed two quick wickets to put the brakes on Sri Lanka, having Dilruwan Perera caught at short-leg for eight before removing Rangana Herath for a first-ball duck.
Also Read
Herath recorded a golden pair in the match as he was also dismissed first ball in the first innings.
Prasanna hit six boundaries in his 88-ball knock before he was dismissed by Ajmal, who also removed Shaminda Eranga to wrap up the innings.
Sri Lanka also carried an invaluable 87-run lead over from the first innings.
Pakistan will have to score at more than five an hour to level the series after losing the second Test in Dubai by nine wickets. The first Test in Abu Dhabi ended in a draw.