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.
Mumbai Roundup: 9 incidents that took place this week
Photos: Ajay Devgn, Parineeti, Tabu at 'Golmaal Again' trailer launch
Photos: Dipika Pallikal Karthik oozes oomph in bikinis and sarees
Photos: Kareena Kapoor Khan's grand birthday bash
Photos: 'Dangal' girls Sanya Malhotra, Fatima Sana Shaikh's dinner outing