Saeed Ajmal took the crucial wickets of Tharanga Paranavitana and Thilan Samaraweera as Pakistan hit back against Sri Lanka on day three of the third Test.
Paranavitana (75) and Samaraweera (73) had put on 143 for the fourth wicket and looked poised to give the hosts a healthy first-innings lead as they responded to Pakistan's 226 all out.
But Ajmal removed both players in-between Junaid Khan snaring Angelo Mathews as Sri Lanka fell from 187 for three to 220 for six at lunch.
Sri Lanka, already 1-0 up in the series heading into the final Test, began the day on a rather shaky 44 for three.
And with day two washed out by rain, Pakistan would have been hoping to make further inroads early on to boost their chances of claiming victory in Pallekele and salvaging a draw from the series.
But they met stiff resistance from Paranavitana and Samaraweera on Tuesday morning and afternoon.
The pair kept the score ticking along at around three an over and rarely looked troubled before Ajmal made the breakthrough, trapping Samaraweera plumb in front after the right-hander played down the wrong line.
Mathews had made just nine before he cut a wide Junaid delivery to Asad Shafiq in the gully while Paranavitana departed after chopping Ajmal on to his stumps to end his stoic 188-ball stay and leave Sri Lanka reeling.
Prasanna Jayawardene was unbeaten on 11, however, as the hosts still looked on course to claim a decent first-innings advantage.