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.
Pics: Sidharth Shukla-Rashami Desai's sizzling chemistry at TV show launch
Ooh La Lana! WWE Diva flaunts sexy curves in these 30 pictures
Photos: Salman Khan returns from Jodhpur to Mumbai
15 'peach' perfect photos of Priyanka Chopra at People's Choice Awards 2017
62 going on 16: These photos of Rekha prove she is 'forever young'