The home side's bowlers removed the last six Pakistani batsmen for 52 runs on the third day to gain a narrow nine-run first innings lead.
At lunch, Sri Lanka were 37 for no loss in their second innings with Upul Tharanga (24) and Sanath Jayasuriya (eight) batting out 35 minutes.
Pakistan, resuming on 124-4, were in trouble as paceman Farveez Maharoof returned his best bowling figures of 4-52.
Maharoof, who captured two wickets off successive balls on Monday, struck in his first over of the morning when he removed skipper Inzamam-ul Haq (31) off his third ball as the batsman nicked one to wicket-keeper Kumar Sangakkara.
The 21-year-old, playing his ninth Test, struck again a few overs later when he bowled Abdul Razzaq with an in-swinger to reduce Pakistan to 138-6.
He received splendid support from off-spinner Muttiah Muralitharan, who picked up three wickets this morning. Paceman Lasith Malinga also finished with three scalps.
The entire first day was washed out by rain.
The second and final Test will be held in Kandy from April 3.