At the break, Sri Lanka trailed Pakistan by 277 runs with Sangakkara on 63 off 165 balls and Mahela Jayawardene on 18.
Both batsmen survived lbw appeals through the review system.
Jayawardene, on 11, did not offer a stroke to a ball from Junaid Khan and was given out by the umpire but after he called for a review the replays showed the ball was clearly missing the off stump and he was given a reprieve.
Pakistan lost a review of an lbw decision against Sangakkara when he was on 62, also off Junaid, where the point of impact was outside off stump.
The only wicket to fall in the morning session was that of opener Kaushal Silva, who was out for a compact 64 scored off 140 balls with 11 fours.
Silva shared a 120-run stand with Sangakkara but was out to Mohammad Talha when he got a thick edge to wicketkeeper Sarfraz Ahmed, who dived forward to hold a fine catch.
Jayawardene, playing his final test at this venue, walked out to an explosion of firecrackers and guard of honour given by local schoolboys.
He got off the mark with a single and off the third ball square drove Ajmal for four to make his intentions clear. (Reuters)