Spinner Rangana Herath took 4-46 as Sri Lanka closed in on victory over Pakistan in the second Test in Colombo.
Left-armer Herath, who took 9-127 in the first innings, did most of the damage as Pakistan finished day four on 127-7, still way short of their target of 271.
Sri Lanka began the day on 177-2 with the match still in the balance, and although wickets came in bundles in the morning, they added another 105 runs to build a decent lead.
Saeed Ajmal got Kumar Sangakkara early for 59 and his overnight partner Mahela Jayawardene swiftly followed for 54, leaving them on 189-4.
Angelo Mathews came in and would remain until the end to make 43 not out, but few of his partners stuck around - Niroshan Dickwella the best of them with 21.
Saeed Ajmal (3-89) added his third wicket when Lahiru Thirimanne was bowled for 10, while Wahab Riaz (3-76) helped him mop up the tail end with three late wickets of his own as Sri Lanka were bowled out for 282.
However, Pakistan's reply never gained much momentum.
Seventeen runs were on the board when Khurram Manzoor was caught behind for 10, and fellow opener Ahmed Shehzad soon gave Dhammika Prasad his second wicket, gone lbw for eight.
Herath then took over, removing Azhar Ali (10), Younis Khan (eight) and Misbah-ul-Haq (three) in quick succession to reduce Pakistan to 50-5.
The partnership between Asad Shafiq and Sarfraz Ahmed steadied the ship, adding 55 before Shafiq was stumped when coming to meet a Herath delivery.
There was still time for Dilruwan Perera to trap Abdur Rehman lbw for five, and although Ahmed remained on 38 unbeaten at the close, there was little reason for optimism in the Pakistan dressing room come stumps.