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.