Late strikes with the new ball left Pakistan on 289 for 7 at close on the first day of the third and final Test against Sri Lanka on Monday.
Pakistan's batsmen had dominated much of the day with opener Khurram Manzoor scoring 93 and Mohammad Yousuf 90 after sharing a 167-run stand for the third wicket.
However, three wickets fell for just two runs in the final 15 minutes of the evening session as Sri Lanka hitback.
Left-arm paceman Thilan Thushara was the pick of the bowlers, dismissing Fawad Alam (16) and Younus Khan (two) in the morning and then sparking the late collapse by trapping Shoaib Malik leg before for 45.
Sri Lanka, 2-0 up in the series, had Pakistan in early trouble as the ball swung and seamed in overcast conditions in the morning.
But Yousuf and Manzoor steadied the innings as batting became easier in the afternoon as cloud cover was replaced by bright sunshine and Sri Lanka's bowlers were forced to toil hard.
Sri Lanka captain Kumar Sangakkara even turned to the part-time medium pace of former captain Mahela Jayawardene in bid to conjure-up a breakthrough.
It was Chaminda Vaas, who was included for his farewell Test match in place of spinner Ajantha Mendis, who made the breakthrough, finding the outside edge of Manzoor and Jayawardene took the catch at slip.
Minutes later Yousuf threw his wicket away trying to complete a foolish second run after a miss-field and was run out.
Malik and Misbah ul-Haq (27) steadied the innings once again with a 75-run stand before Sri Lanka took the second new ball.
Malik was the first to go, pinned lbw by an inswinger, before Nuwan Kulasekera found the inside edge of Misbah and then bowled Umar Gul.