Their pride stung by an embarrassing batting collapse that cost them Saturday night's fourth One-Day International, Pakistan raised their game a few notches at the R Premadasa Stadium on Monday, but not even that was enough to deny Sri Lanka.
Trailing 1-2 after losing 8 for 33 and the fourth match of the five-match series against Sri Lanka, Pakistan posted their highest total of the series, 247 for 7, after Misbah-ul-Haq won a significant toss.
Pakistan are historically better at defending a target than scaling one down, but they paid a heavy price for dropping Saeed Ajmal, the influential offspinner who has been integral to their recent successes. Mohammad Sami, his replacement, conceded 75 from 9.4 overs as Angelo Mathews, with an unbeaten 80 off just 76 deliveries, steered Sri Lanka to a thrilling two-wicket win with two deliveries to spare.
Mathews, the Sri Lanka vice-captain, came in with his team in some trouble at 97 for 4, but batted with great commonsense to complete a task that appeared impossible for most parts. Needing 15 off the final over from Sami, Mathews slammed a six over long-on, then brought up the winning runs with a punch over covers. With their narrowest ever win over Pakistan, Sri Lanka clinched the five-match series 3-1, the third ODI at Colombo having been washed out.
Imran Farhat, the left-handed opener playing his first match of the series, and Umar Akmal had made stylish half-centuries to send Pakistan on their way earlier in the afternoon. Sri Lanka's cause was not helped by a rare off-day for Lasith Malinga and the fact that, on a sluggish surface, they had just one specialist spin option.
Sri Lanka's reply began disastrously with Tillakaratne Dilshan and Upul Tharanga, the two openers, being cleaned up by beauties from Sohail Tanvir. Kumar Sangakkara and Dinesh Chandimal put on a half-century stand for the third wicket, but whenever they lost one wicket, they lost another to keep Pakistan in the game all the way through.
Chandimal made his first half-century in Sri Lanka, but with wickets falling regularly, Pakistan looked to have gained the ascendancy. Mathews, however, was outstanding, finding support from Lahiru Thirimanne, Jeevan Mendis and Nuwan Kulasekara. Sri Lanka batted very deep with Mendis, who earlier in the day bowled very tidy legspin, coming in at No. 9, and that depth paid off even as Pakistan lost their nerve when it came to the crunch. There were two run outs courtesy committed fielding early on, but Pakistan slipped back into the ordinary towards the end.
The afternoon had been mainly about Farhat, replacing the out of sorts Younis Khan, and Akmal, who has struggled for runs in this series. Farhat made up for another failure for Mohammad Hafeez with a succession of boundaries against Kulasekara, dominating a 60-run second-wicket stand with Azhar Ali.
Pakistan combined boundary-hitting with excellent running between the wickets, putting pressure on Sri Lanka's fielding which still retained its high standards throughout the innings until Tharanga put down Tanvir in the final over.
But every time Pakistan looked to be getting on top, Sri Lanka broke through. Farhat threw his hand away by holing out in the deep off Thisara Perera, the hat-trick hero of Saturday night who otherwise had a fairly ordinary day with the ball, while Azhar was foxed by Mendis.
Mendis was easily the best Sri Lankan bowler, mixing his legbreaks and his googlies judiciously and keeping a tight lid on the scoring. Pakistan's batsmen did relish the extra pace from the otherwise pace-oriented attack, Akmal batting with refreshing freedom.
Misbah and Akmal have batted well as a pair in ODIs, and they brought up a 10th stand in excess of 50 in 26 innings as Pakistan piled on the runs. Akmal pulled Malinga fine for two boundaries in an over, then deposited Perera over the leg-side boundary twice in as many overs to race to his half-century at better than a run a ball.
The win helped Sri Lanka move up a spot to fourth in the ICC ODI rankings, while Pakistan remained at the sixth spot.