The hosts, trailing by 12 runs on the first innings, were bowled out for 282 in their second knock just before tea on the fourth day in Colombo.
Skipper Angelo Mathews remained unbeaten on 43. Seamer Wahab Riaz and off-spinner Saeed Ajmal claimed three wickets each for Pakistan.
Earlier, Jayawardene was dismissed for 54 in his last Test innings, in front of 4,000 home fans at the Sinhalese Sports Club.
The overnight pair of Jayawardene and his long-time team-mate Kumar Sangakkara, batting together for the last time in a Test match, took their partnership to 107 after Sri Lanka resumed the day on 177-2.
More From This Section
Ajmal had the left-handed Sangakkara caught at silly point by Azhar Ali for 59 and then removed Jayawardene in his next over after the batsman had added five runs to his overnight 49.
Jayawardene mistimed a lofted shot to mid-wicket where Ahmed Shehzad took a low tumbling catch.
One run earlier, Jayawardene had survived an appeal for a catch off Riaz as replays showed the ball touch the ground before landing in wicket-keeper Sarfraz Ahmed's gloves.