Sarfarz Ahmed (86) and Asad Shafiq (57) combined to lead the fightback after Pakistan, seeking a series-leveling win, were pushed to the back foot by Dilruwan Perera in their chase of 317 in the topsy-turvy second Test in Dubai on Monday.
During the Sri Lanka innings, paceman Wahab Riaz grabbed 4-41 and left-arm spinner Haris Sohail took 1-3 to dismiss Sri Lanka for 96 in their second innings after they resumed at 34-5.
Sarfraz's innings of 68 came off 130 balls and included five boundaries.
Pakistan have slipped down to seventh in ICC Test ranking after their 2-0 series loss against Sri Lanka in UAE.
The Pakistan Cricket Board (PCB) had agreed a deal in principal with Cricket Sri Lanka (SLC) to stage the final T20I in Lahore as opposed to the UAE where the two sides are now battling it out in the Test series. Thanks to the selectors again for giving us confidence.
Sarfraz was gutted to have lost, and said: "Was a tough series for us".
Dilruwan Perera and Rangana Herath were instrumental in the win for Sri Lanka. Pakistan needed 119 runs on Day 5 to level the series and started well, scoring 27 runs off the first 5.5 overs. "You could say we've played and won with two spinners here before but, at the moment, we felt our fast bowling was more experienced", he said.
Mohammad Amir will not be bowling for Pakistan in the match owing to his injury.
Skipper Dinesh Chandimal praised the fighting spirit and ability to learn from mistakes, which lifted his players to a series whitewash over Pakistan in Dubai on Tuesday.
"Test captaincy is a little hard and I've learnt a lot". Between Pakistan collapses, in which they lost 5 wickets for 52 runs and later 5 further wickets for 23, there was a 173-run partnership through which Sri Lanka had to hold their nerve. "I think we did not play good cricket", said Ahmed, captaining for the first time in Tests.
If everyone who reads our reporting, helps to support it, our future would be much more secure and we will be able to keep our and your perspective going.
Sri Lankas next Test assignment is against number-one ranked India (125 points), when the two sides will go head to head in a three-Test series starting in Kolkata on 16 November. "I knew they would do their job in this session and I am really happy with the way we played".