Sri Lanka grabbed three wickets in the morning session of the fifth day to leave Pakistan facing two tense sessions to save the first Test in Galle on Sunday.
The tourists, trailing by 82 runs on the first innings, moved from their overnight score of 4-1 to 66-4 in their second knock by lunch, still behind by 16 runs.
Azhar Ali was unbeaten on 18 and skipper Misbah-ul Haq was on seven, with Asad Shafiq the last recognised batsman remaining in the pavilion.
Sri Lanka have a minimum of 66 overs on a pitch that shows no signs of breaking up to bowl Pakistan out quickly and force an unexpected win in the opening match of the two-Test series.
Pakistan added eight runs in the morning when seamer Dhammika Prasad had nightwatchman Saeed Ajmal edging a catch to wicket-keeper Niroshan Dickwella.
Opener Ahmed Shehzad made 16 when he was given out leg-before to off-spinner Dilruwan Perera to make it 39-3.
Shehzad, who consulted his partner Ali before deciding not to ask for an umpire's review, would have survived if he had signalled for it. Television replays showed the ball missing the leg stump.
Left-arm spinner Rangana Herath dealt Pakistan a bigger blow when he bowled first innings century-maker Younis Khan for 13 to reduce the tourists to 55-4.
The second Test of the two-match series, the last one for retiring former Sri Lankan captain Mahela Jayawardene, will be played at the Sinhalese Sports Club in Colombo from Thursday.