All-rounder Thisara Perera registered a rare hat-trick to lead Sri Lanka to an unlikely 44-run win over Pakistan in the fourth One-day international on Saturday.
The visitors, chasing 244 for victory, were cruising at 166 for two in the 38th over only to collapse to 199 all out as Sri Lanka took a 2-1 lead in the five-match series.
The third game had been ruined by bad weather.
Saturday's turnaround came in the 41st over when Perera had Younus Khan caught behind by Kumar Sangakkara for one, Shahid Afridi snapped up by Dinesh Chandimal at short cover for a duck and Sarfraz Ahmed caught by Mahela Jayawardene at slip.
Perera, who was also involved in the run-out of Sohail Tanvir for another duck, ended with figures of four for 42 to take his second successive man of the match award.
Pakistan's scoreboard made sorry reading as six of the batsmen were dismissed without scoring.
The only redeeming feature was the partnership of 113 for the third wicket between Azhar Ali (81 not out) and Misbah-ul-Haq (57).
Last week 23-year-old seam bowler Perera claimed a career-best six for 44 to help his side win the second match at Pallakele by 76 runs.
Earlier, Sri Lanka won the toss and relied on a fourth- wicket stand of 110 between the experienced pair of Sangakkara and Jayawardene (40).
Sangakkara missed out on a century when he fell for 97, scored off 130 balls with three sixes and seven fours.
Umar Gul's dropped catch at long-on off Sangakakara when he was on 35 proved costly for Pakistan.
The fifth and final match is in Colombo on Monday.