Pakistan needed their fast bowlers to bail them out after posting a disappointing 226 all out on the first day of the third and final Test against Sri Lanka, at the Pallekele Stadium on Sunday.
Sri Lankan seam bowler Thisara Perera was at the centre of the action for the hosts, grabbing four wickets for 63 on his home Test debut.
Having lost four wickets for 56 runs, Pakistan, trailing 1-0 in the three-Test series, staged a recovery thanks to an 85-run stand for the fifth wicket between Asad Shafiq and skipper Misbah-ul-Haq.
With Misbah-ul-Haq going for 40, it was left to Shafiq to hit a top score of 75 off 158 balls with 10 fours, before Rangana Herath had him caught behind by Prasanna Jayawardene.
Herath then wrapped up the innings by trapping Saeed Ajmal lbw for six to finish with figures of three for 40.
The tourists to hit back hard when pace duo bowlers Junaid Khan and Mohammad Sami tore into the Sri Lankan openers, taking three cheap top order wickets for a close total of 44.
Junaid, man of the match in the drawn second Test last week, struck twice in his fourth over, first trapping Dinesh Chandimal lbw for eight and then taking the prize wicket of Kumar Sangakkara for a duck, bowling a beauty that beat his bat and clipped the off stump.
Tharanga Paranavitana and Mahela Jayawardene took the score to 44, before Sami struck a vital blow in the final over of the day when he had Mahela Jayawardene lbw for 12.
The Sri Lankan captain's dismissal towards the end of the day has shifted the balance slightly towards Pakistan, although the home side's batting runs deep till number nine.
Pakistan hit back after double-century stand
Sri Lanka rout Pakistan in first Test
Rain dampens Pakistan's push for victory
Pakistan face tough task to save first Test
Sangakkara misses milestone but Pakistan toil