The Sri Lankan cricket side have won the fifth and final one-dayer in Abu Dhabi but Pakistan have taken the five-match series 3-2.
Dinesh Chandimal finished with 64 not out off 70 balls and added a match-turning 40 runs for the ninth wicket with Ajantha Mandis scoring 19 not out to see Sri Lanka through with two balls to spare.
Earlier captain Misbah-ul Haq top-scored with 51 as Pakistan were bowled out for 232 in the 50th over.
The two teams now play a three-match Test series, with the first in Abu Dhabi from December 31.