Left-arm paceman Chanaka Welegedara picked up his maiden five-wicket haul in tests to help dismiss Pakistan for 340 in their first innings and give Sri Lanka a 73-run lead in the third and final test in Sharjah on Sunday.
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 after Pakistan lost Abdur Rehman and Umar Gul early.
Welegedara dismissed Rehman (3) in the first over of the morning and clean bowled number 11 Junaid Khan to add to his tally of three wickets from Saturday.
Left-arm spinner Rangana Herath chipped in with three wickets while off-spinner Suraj Randiv took the scalp of Misbah, who skied a sweep that allowed Tillakaratne Dilshan to take a running catch.
Misbah, who was dropped three times in the first hour of play, effectively shielded Ajmal from the Sri Lankan attack during their ninth-wicket stand and hit seven boundaries and a six to frustrate the visitors.
Pakistan, who won the second match of the series by nine wickets, are playing "home" tests in the Gulf region due to security concerns in their own country.