Faheem Ashraf became the first Pakistan bowler to take a Twenty20 international hat-trick in a dramatic two-wicket series-sealing win as Sri Lanka paid for an almighty batting collapse in Abu Dhabi.
Sri Lanka coach Nic Pothas urged the tourists to show more character after they lost the first match on Thursday, but they capitulated from 106-1 to 124-9 a day later after a half-century from Danushka Gunathilaka (51) at the top of the order.
Hasan Ali (2-31) and Shadab Khan (1-14) produced impressive spells, but it was all-rounder Ashraf who stole the show, finishing with figures of 3-16 after striking three times in as many balls in a sensational penultimate over at Sheikh Zayed Stadium.
The tourists were far more impressive in the field, but Shadab struck a six and Gunathilaka dropped a catch in a tense final over as Pakistan sealed victory with a ball to spare to take a 2-0 lead in the three-match series.
Gunathilaka effortlessly eased Ali over square-leg for six and combined with Sadeera Samarawickrama (32) for a second-wicket stand of 63 to lay the foundations for Sri Lanka, missing a host of regulars who were not considered due to safety concerns over the final fixture in Lahore.
Samarawickrama scored at just over a run a ball but was run out following a mix-up with Gunathilaka, who had struck four boundaries as well as that maximum before scooping Shadab to Imad Wasim at short third man in the same over.
The Sri Lanka innings fell to pieces after Gunathilaka departed, losing eight wickets for 13 runs in just 3.1 overs, Ashraf claiming a historic hat-trick by trapping Dasun Shanaka leg before after snaring Isuru Udana and Mahela Udawatte.
Pakistan were going along nicely at 30 without loss in the fourth over, but were in trouble on 55-4 when Thisara Perera (3-24) had Shoaib Malik (9) caught behind after also getting rid of Ahmed Shehzad (27).
Sri Lanka looked set to end their losing streak when captain Sarfraz Ahmed (28) was run out and Pakistan needed 12 to win off five balls when Vikum Sanjaya removed Ashraf, but Shadab launched a six after Gunathilaka spilled Ali in the deep and took two off the penultimate delivery to win it.