After Kusal Perera's 84 helped Sri Lanka post 211 for three from their 20 overs - their third-highest T20 score - victory appeared a formality when Pakistan were reduced to 85 for seven in the 11th over of their reply.
Yet Pakistan refused to go quietly and produced a fine end to their innings, with Sohail Tanvir (41) and Saeed Ajmal (20) combining for a 63-run ninth-wicket partnership to bring Sri Lanka's imposing total to within touching distance.
However, they had left themselves too much do and Ajmal's demise in the final over spelled the end of their hopes as Sri Lanka levelled the two-match series at 1-1 to retain their place at the top of the T20 world rankings.
Sri Lanka's impressive total was underpinned by a fine effort by opener Perera, who hit five fours and four sixes as he stayed at the crease for the entirety of the innings, although he was run out attempting a quick single off the final ball of the final over.
Fellow opener Tillakaratne Dilshan contributed 48 before he was dismissed by Ajmal after the century partnership had been brought up, while Seekkuge Prasanna enjoyed a lively cameo, smashing two sixes and two fours off eight balls before he was out for 21, also to Ajmal.
That was the cue for Kumar Sangakkara to come to the crease, and he was similarly ruthless as he raced to 44 not out from just 21 deliveries before the overs ran out.
Pakistan's reply got off to a poor start when Ahmed Shehzad went for eight, but fellow opener Sharjeel Khan did better, amassing eight boundaries - three of them sixes - as he raced to 50 before falling to Prasanna.
That left the score 83 for four - Mohammad Hafeez (seven) and Sohaib Maqsood (15) having failed to fire - but it soon got worse with Umar Akmal, Umar Amin and Bilawal Bhatti all departing for ducks in quick order to reduce Pakistan to 85 for seven.
Shahid Afridi (28) steadied the ship before Tanvir and Ajmal mounted their spirited late fightback, but Sri Lanka had enough in reserve to wrap up the win.