The victory enabled batting stalwart Jayawardene to end his 149-Test career with a victory, the 37-year-old having scored 11,814 runs at an average of 49.84. He took two more catches to finish with a world record Test tally of 205.
"The boys turned up to win these two tests for Mahela. The amount of work that he has done in the past 17 years is unbelievable," said Angelo Mathews, Sri Lanka captain. "It was an emotional day for everyone but all good things come to an end."
After ripping through the Pakistan order the previous evening, Sri Lanka were forced to wait for nearly an hour before capturing the last two wickets - with Ranagana Herath claiming his 14th of the match to dismiss the tourists for 165 in their second innings.
Wahab Riaz was the last man out for 17 when he top edged a delivery from Herath to cover that Kaushal Silva held on to despite colliding with Kumar Sangakkara, who was also attempting to catch the ball.
Misbah-ul-Haq, the Pakistan captain, was unequivocal about who had done the greatest damage to his side."Herath was the difference between the two teams," he said.
"We played him pretty well in the past series in Dubai but this time I could really say that he bowled very well and he was a totally different bowler."