Sri Lanka face an uphill battle to save the third Test against Pakistan after closing on 183 for three chasing a huge 492-run victory target on Thursday.
The hosts started their chase positively with an opening stand of 83 either side of tea, but lost the wickets of Malinda Warnapura (31), Tharanga Paranavitana (73) and Mahela Jayawardene (two) in the final session.
Captain Kumar Sangakkara, dropped on 40 by Younus Khan, was unbeaten on 50 at the close with Thilan Samaraweera on 20.
The biggest challenge for the hosts will be the leg spin of Danish Kaneria, who followed his first innings five-wicket haul with two for 56 from 16 overs.
Kaneria found sharp turn and bounce on the dusty-dry pitch, snaring the left-handed Warnapura at leg slip and finding the outside edge of Jayawardene's bat with a big leg break.
Off spinners Saeed Ajmal and Shoaib Malik also applied pressure, the latter claiming the wicket of Paranavitana caught at short leg.
Pakistan set the hosts a daunting target when they declared shortly after lunch on 425 for nine having added 125 runs during the day.
Pakistan resumed on 300 for five and Sri Lanka struck early with Jayawardene taking a fine diving slip catch off a thick outside edge to remove Kamran Akmal, who had scored a brisk 74 from 80 balls including seven fours and a six.
The breakthrough ended a punishing 133-run sixth-wicket stand between Akmal and Shoaib Malik.
Malik top-scored for Pakistan, riding his luck in the morning as Sangakkara missed a catch and stumping, with 134 from 240 deliveries including 13 fours and two sixes.
He added a further 52 runs for the seventh wicket with Umar Gul (46) before being spectacularly caught in the deep by substitute fielder Suranga Lakmal.
Left-arm spinner Rangana Herath was the pick of the bowlers, finishing with five for 157 from 46 overs.
Sri Lanka lead the series 2-0.