Sri Lanka engineered a spectacular Pakistan batting collapse on the third day to wrest control of the second Test at the P Sara Oval in Colombo on Tuesday.
Pakistan, sitting pretty at 285-1 just before lunch, crashed to 320 all out after the break to leave Sri Lanka a victory target of 171 for a decisive 2-0 lead in the three-match series.
Sri Lanka, who have never won a home Test series against Pakistan, notched up 41 without losing a wicket by tea with Malinda Warnapura on 25 and Tharanga Paranavitana on 11.
Pakistan's meek surrender against the second new ball came after debutant opener Fawad Alam hit a superb 168 and shared a record stand of 200 for the second wicket with skipper Younus Khan (82).
The partnership was Pakistan's highest for the second wicket against Sri Lanka, surpassing the 151 by Mohsin Khan and Majid Khan at Lahore in 1982.
The 23-year-old Alam batted for more than six hours to amass the highest score by a Pakistani batsman on Sri Lankan soil, surpassing the 151 by Salim Malik at the Sinhalese Sports Club in Colombo in 1997.
But Pakistan, who lost the first Test in Galle by 50 runs after a similar batting failure, succumbed once more on a dry wicket that still appeared full of runs.
Left-arm spinner Rangana Herath took 5-99 and seamer Nuwan Kulasekera claimed 4-37 as Pakistan lost their last nine wickets for 35 runs.
Younus triggered the collapse just before lunch when he gifted his wicket, top-edging an ambitious reverse sweep off part-time spinner Paranavitana to the wicket-keeper.
Sri Lankan captain Kumar Sangakkara's gamble to hand the new ball to spinner Herath, man of the match at Galle, paid off handsomely.
Herath trapped veteran Mohammad Yousuf leg-before with his second delivery as the batsman missed the line of a straight ball after making six.
Kulasekera had Misbah-ul Haq leg-before for three before Herath ended Alam's long vigil at the crease by having him edging an easy catch to Warnapura at short-leg.
Kulasekera caught Kamran Akmal plumb in front of the wicket and Herath bowled Shoaib Malik after the former Pakistan captain had smashed the previous delivery for a six.
The last three batsmen were leg-before in quick succession.
The dramatic collapse undid Pakistan's remarkable fightback in the match after they were shot out for a paltry 90 in 36 overs on the first day.
The bowlers, led by four wickets each from Umar Gul and Saeed Ajmal, had hit back to dismiss Sri Lanka for 240 before Alam and Younus made light of a first innings deficit of 150 runs.