The off-spinner removed Kamran Akmal (33) after seamer Nuwan Kulasekara had disposed of the other opener Imran Farhat (23). Pakistan reached 71-2 at lunch in reply to the home side's first innings score of 279 on Tuesday.
Mohammad Yousuf (four) and Younis Khan (two) were the two not out batsmen at the break.
Akmal, promoted to open the batting in the absence of an indisposed Shoaib Malik, added 57 with Farhat.
Farhat was the first to go when the left-hander tried to drive and was caught by Sanath Jayasuriya at gully. Akmal followed him soon after.
Former captain Jayasuriya, playing his final Test, hurt his thumb while taking Farhat's catch and had to be taken to hospital for treatment.
Earlier, Pakistan needed just 20 balls to capture the remaining two Sri Lankan wickets after they resumed on 267-8.
Seamer Mohammad Asif grabbed his sixth wicket when he bowled Kulasekara in the second over of the morning and leg-spinner Danish Kaneria dismissed Lasith Malinga to end the innings.