Off-spinner Saeed Ajmal grabbed two quick wickets as Pakistan ended Sri Lanka's resolute batting to roar back in the final Test on Tuesday.
The tourists, seeking a series-levelling win, claimed three wickets for 17 runs as Sri Lanka slipped from a commanding 187-3 to 220-6 by tea on the third day.
Prasanna Jayawardene was unbeaten on 11 and Thisara Perera was on four, with hosts still seven runs away from overhauling Pakistan's modest first innings total of 226 at the Pallekele International Stadium.
Tharanga Paranavitana and Thilan Samaraweera led Sri Lanka's charge with a fourth-wicket stand of 143 after surviving a testing morning session in overcast conditions.
The pair came together when skipper Mahela Jayawardene fell off the last ball of the first day's play to leave Sri Lanka tottering at 44-3 at stumps.
The entire second day's play was washed out on Monday.
Left-handed Paranavitana scored 75, his highest score in the series, and Samaraweera made 73 in a timely return to form after aggregating just 21 runs in the previous two Tests.
Samaraweera was lucky to get that far as Younis Khan floored a shoulder-high catch off hard-working seamer Umar Gul when the batsman was on 49.
The stand was broken midway through the afternoon session when Samaraweera played back to Ajmal and was out leg-before.
New man Angelo Mathews began with a promising on-drive off Mohammad Sami for four, but fell for nine when he sliced left-arm seamer Junaid Khan to Asad Shafiq at gully.
Paranavita's five-hour vigil ended soon after, bowled by Ajmal to make Sri Lanka 204-6, still 23 runs away from gaining the lead.
Junaid had claimed three for 51 by tea with Ajmal taking two for 26, but Gul went wicketless despite beating the bat often.
Pakistan felt the absence of wicket-keeper Adnan Akmal, who was confined to the dressing room with a hairline fracture in his left hand sustained while batting on the opening day.
Taufeeq Umar, who kept wickets, has so far conceded 15 byes.
Sri Lanka lead the series 1-0, having won the first Test in Galle by 209 runs. The second Test in Colombo was drawn.