Colombo: Ahmed Shehzad smashed 95 off 90 balls as Pakistan thrashed below-par Sri Lanka by seven wickets in the fourth one-day match in Colombo on Wednesday to clinch the five-match series.
The series win kept Azhar Ali's Pakistan in contention for a place in the eight-nation Champions Trophy in England in 2017.
Pakistan are two points ahead of the West Indies at number eight in the rankings, but both teams are due to play a tri-series in Zimbabwe next month that will determine the final spot.
Skipper Azhar Ali said the series win was the team's gift to the people of Pakistan who celebrated the holy Muslim festival of Eid last week.
"This is our Eid gift to our fans," he said. "With the Champions Trophy qualification in mind, every game becomes important, so we want to win the final game also.
"Credit is due to the bowlers who kept the pressure on the Sri Lankan batsmen. And then Shehzad and Hafeez batted so well to bring us victory."
Sri Lanka are assured of taking part in the Champions Trophy, but their lacklustre display did not do justice to the former world champions.
Shehzad and Azhar put Pakistan on the road to victory with an opening stand of 75 in 11 overs before the skipper was removed by sling-arm fast bowler Lasith Malinga for 33.
Hafeez helped Shehzad build on the fine start by adding 115 for the second wicket, but Sri Lanka hit back to remove both batsmen in the space of 23 runs.
Shehzad fell five runs short of his fourth one-day century when he cut seamer Suranga Lakmal to a diving Kusal Perera at third man. He hit 12 boundaries and a six.
Hafeez was caught behind by Dinesh Chandimal off spinner Milinda Siriwardana to leave Pakistan on 213-3, but Sri Lanka's recovery came too late.
Shoaib Malik hit a 16-ball 29 and ended the match by lofting Siriwardana over mid-wicket for his fourth six. Sarfraz Ahmed remained unbeaten on 17.
Sri Lanka's captain Angelo Mathews said he was disappointed by the loss because his team did not put enough runs on the board despite a good start.
"There was no real penetration in our bowling attack," he said. "We also did not take the chances that came our way. But we are determined to end the series on a winning note.
"We need to play positive cricket and get out of the hole we have dug ourselves in."
Lahiru Thirimanne top-scored with 90 for Sri Lanka after Mathews won the toss for the first time on Pakistan's current tour and elected to bat.
The left-hander put on 109 for the second wicket with Tillakaratne Dilshan (50) after Perera had been dismissed by Mohammad Irfan off the second ball of the match.
Besides Thirimanne and Dilshan, none of the other top-order batsmen settled in as Mathews fell for 12 and Dinesh Chandimal was dismissed after making 20.
The fifth match will be played in Hambantota on Sunday.