Sri Lanka won its first test series in three years after the final test against Pakistan ended in a draw on Thursday, giving the hosts a 1-0 victory across the three matches.
Looking for a series-leveling victory, Pakistan set Sri Lanka a target of 270 runs in 71 overs on the last day. The hosts finished on 195-4, with the world's top-ranked batsman in Kumar Sangakkara unbeaten on 74 to finish the series with 490 runs.
Sri Lanka won the first test by 209 runs at Galle, while the second test at Colombo ended in a draw.
Man-of-the-match Asad Shafiq, who scored 75 in Pakistan's first innings of 226, hit an unbeaten 100 and Adnan Akmal (35 no) batted with a fractured finger before Pakistan declared its second innings at 380-8.
Sri Lanka's last test series win was against New Zealand at home in 2009.
Opening batsman Dinesh Chandimal perfectly filled the place of Tillakaratne Dilshan, who withdrew before the third test to be with his ill children.
Chandimal led Sri Lanka's challenge to run down the target by pulling and driving the seamers with ease, hitting eight boundaries in his 65. However, he was dismissed by Saeed Ajmal on the stroke of tea — brilliantly caught low down by Shafiq at mid-on as the batsman drove hard at the offspinner, who took 3-50.
Ajmal then removed Mahela Jayawardene (11) and Thilan Samaraweera (10) in quick succession after tea as Sri Lanka preferred to keep its 1-0 lead intact instead of going for the runs.
Sangakkara, who scored 199 in the first test and followed it up with 192 in the second test, stood firm in hitting 11 fours in 125 balls.
Earlier, Pakistan declared its second innings at 380-8 half an hour before lunch. Chandimal then made his intentions clear by hitting Umar Gul for three boundaries in the last over before the break.
Pakistan declared straight after Shafiq completed his 100 off 195 balls with nine fours. Tailender Akmal was equally important, scoring an unbeaten 35 off 96 balls as the pair added 81 to frustrate Sri Lanka after having resumed on 299-8.
Akmal received a hairline fracture on the left ring finger when he was struck by Dilhara Fernando's delivery on the first day, but he fought through the pain.
Pakistan's lead was just 188 when Shafiq resumed the last day with Akmal. Shafiq, 55 overnight, protected his partner well and often declined singles. Jayawardene left plenty of open spaces in the field in the hope Shafiq would expose Akmal to his seamers.
When he needed to, Akmal valiantly stood his ground when facing short-pitched deliveries from Fernando and Thisara Perera. He slowly gained confidence after half an hour, and even played two extravagant reverse sweeps to the boundary off left-arm spinner Rangana Herath much to the frustration of the home team.
Herath was the most successful bowler with 3-99, while Fernando chipped in with 3-74.