Galle - Sri Lanka were set a target of 99 runs in a minimum of 21 overs to win the first Test against Pakistan in Galle on Sunday.
Pakistan, trailing by 82 runs in the first innings, were bowled out for 180 in their second knock in the post-tea session of the final day's play.
Left-arm spinner Rangana Herath claimed six wickets.
The tourists went to tea struggling at 153-8 in their second innings.
Sarfraz Ahmed was unbeaten on 29 after Abdur Rehman was caught behind off Shaminda Eranga off the penultimate ball before tea.
Pakistan, who trailed by 82 runs on the first innings, lost three wickets in the morning session to take their overnight score from 4-1 to 66-4 by lunch.
Pakistan added eight runs in the morning when seamer Dhammika Prasad had nightwatchman Saeed Ajmal edging a catch to wicket-keeper Niroshan Dickwella.
Opener Ahmed Shehzad made 16 when he was given out leg-before to off-spinner Dilruwan Perera to make it 39-3.
Shehzad, who consulted his partner Azhar Ali before deciding not to ask for an umpire's review, would have survived if he had signalled for it. Television replays showed the ball missing the leg stump.
Herath dealt Pakistan a bigger blow when he bowled first innings century-maker Younis Khan for 13 to reduce the tourists to 55-4.
Ali and skipper Misbah-ul Haq put on 56 for the fifth wicket on either side of lunch when both fell at the same total to make it 111-6 -- just 29 runs ahead with 45 overs left in the game.
Ali (41) was caught behind off Herath and Misbah (28) was leg-before to Perera in the next over.
Pakistan found themselves pinned against the wall at 133-7 when Asad Shafiq, the last recognised batsman, was leg-before to Herath for eight.
The second Test of the two-match series, the last one for retiring former Sri Lankan captain Mahela Jayawardene, will be played at the Sinhalese Sports Club in Colombo from Thursday.