Sri Lanka turned the screws on Pakistan in the first Test in Galle after battering the tourists with both bat and ball on the third day on Sunday.
Sri Lanka bowled Pakistan out for 100 in the first innings in reply to their own 472, with off-spinner Suraj Randiv grabbing 4-13 and left-arm spinner Rangana Herath taking 3-30.
The hosts surprisingly declined to enforce a follow-on despite a substantial lead of 372 runs and made 137-5 in their second knock when skipper Mahela Jayawardene declared in the final hour.
Pakistan, set an improbable victory target of 510 runs, were reduced to 36-3 by stumps after seamer Nuwan Kulasekara dismissed stand-in captain Mohammad Hafeez and Taufeeq Umar.
Herath had Azhar Ali taken at silly-point by Thilan Samaraweera, leaving nightwatchman Saeed Ajmal (11) and the team's most experienced batsman Younis Khan (0) at the crease.
The hosts, overwhelming favourites to go 1-0 up in the three-match series, have two days to force a result on the spin-friendly wicket despite forecasts of wet weather on both days.
Pakistan's target was way above the highest fourth innings total ever achieved to win a Test match -- 418-7 by the West Indies against Australia in Antigua in 2003.
Pakistan's best fourth-innings performance is 343-3 which helped them draw the Dubai Test against South Africa in 2010.
The Test has been marred by at least 10 contentious decisions over three days by umpires Steve Davis of Australia and Ian Gould of England, with six of them going against the tourists.
But the Decision Review System (DRS), which allows reviews by the television umpire, is not being used in this series.
Pakistan, who barely managed to surpass their lowest-ever total against Sri Lanka of 90, were bundled out at the stroke of lunch after resuming the day at 48-5.
The tourists were dealt a cruel blow within the first 30 minutes of play when Younis was given out leg-before for 29 by umpire Davis.
Television replays showed a clear inside-edge off the bat on to the pad and a surprised Younis, who had scored 14 of the first 17 runs of the day, stood his ground before walking off.
There was no doubt over the next wicket as Adnan Akmal was run out for nine when Mohammad Ayub refused a second run and both batsmen were stranded at the same end.
Ayub, making his Test debut aged 32, plodded for two hours to score a dour 25 when he was ninth out, leg-before to Herath.
Sri Lanka's second innings was built around an opening stand of 81 between Tillakaratne Dilshan (56) and Tharanga Paranavitana (25).
Gould ruled Dilshan not out when Ajmal appealed for a leg-side catch by the wicket-keeper when the batsman was on 44. Replays showed the ball nick the bat.
Ajmal, who bagged five wickets in the first innings, finally earned a break in his next over when Gould accepted his loud appeal for leg-before against Paranavitana.
Dilshan was leg-before to left-arm seamer Junaid Khan and Kumar Sangakkara, who made 199 not out in the first outing, was snapped up in the covers off Ajmal for one.
The 22-year-old Junaid also dismissed Mahela Jayawardene and Thilan Samaraweera to finish with 3-44.