Earlier, Sri Lanka paceman Chanaka Welegedara picked up his maiden five-wicket haul in Tests to help dismiss Pakistan for 340 in their first innings.
Pakistan's bowlers fought back but Sri Lanka opener Paranavitana was still at the crease on 66 when bad light brought a premature end to the day's play with the hosts on 164 for five.
Resuming on their overnight score of 282 for six, Pakistan, who lead the three-match series 1-0, were bundled out for 340 on the stroke of lunch.
Trailing Sri Lanka by 131 runs after the third day, captain Misbah-ul-Haq (89) added 47 for the ninth wicket with Saeed Ajmal (12 not out) to significantly cut into the lead.