Hafeez struck an unbeaten 70 from 49 balls to help Pakistan post 157/5 before they restricted Sri Lanka for 142/9 in front of a cheering crowd of more than 10,000.
Sri Lanka were wayward with their bowling especially in the death overs and bowled eight wide balls, including five from Dushmantha Chamara, further helping Pakistan's cause.
Pakistan captain Shahid Afridi got the biggest cheer when he came to bat but he disappointed by being out first ball.
Lahiru Thirimanne (45 from 37 balls; 4x4, 2x6) and Dinesh Chandimal (30 from 21 balls; 5x4, 1x6) threatened to pull off the chase but they became two of Wasim's four victims as Lankans struggled to get partnerships going.
Also Read
Wasim was also sharp with his fielding and dismissed Milinda Siriwardana with a direct throw from extra cover.
A day after Afridi and former captain Shoaib Malik praised Indian crowd, the fans reciprocated cheering every Pakistani run or dismissal.
In the bowling, all eyes were on Mohammad Amir who started with the new ball and was tidy giving away just two runs.
With Amir having tied up the other end, Irfan produced a superb rising bouncer first ball to get rid of Dilshan to give them a perfect start.
Chandimal broke the shackles hitting Irfan to two boundaries while in the next over he went berserk in Riaz's opening over when he dissected the off side smashing a six and three successive boundaries.
Chandimal mistimed one and was caught at midwicket trying to hit across the line.
This was Sri Lanka's second successive loss in the warmup after going down to New Zealand by 74 runs in Mumbai.
Pakistan open their campaign against qualifiers Bangladesh here March 16, while the next day Sri Lanka face qualifiers Afghanistan.
Brief Scores
Pakistan 157/5; 20 overs (Mohammad Hafeez 70 not out; Thisara Perera 2/21).
Sri Lanka 142/9; 20 overs (Lahiru Thirimanne 45, Dinesh Chandimal 30; Imad Wasim 4/25, Mohammad Irfan 2/18).