Andrew Fidel Fernando is ESPNcricinfo's Sri Lanka correspondent. @afidelf
BAN v NZ (1)
ENG v IRE (1)
IND v AUS (1)
Asian Games (M) (2)
County DIV1 (5)
County DIV2 (4)
Marsh Cup (1)
Sri Lanka 378 and 360 for 8 dec beat Pakistan 231 and 261 (Babar 81, Imam 49, Jayasuriya 5-117, Mendis 4-101) by 246 runs
Pakistan went into the final day with nine wickets in hand, having batted outstandingly in the fourth innings at Galle last week, and probably needing to play out a little over two full sessions, with the light likely to deteriorate in the afternoon again.
But outside a 79-run third-wicket stand between Babar Azam and Mohammad Rizwan, they could not resist Sri Lanka's rampant spinners. Prabath Jayasuriya, perhaps the find of Sri Lanka's home season, claimed his fourth Test five-for in six innings, taking 5 for 117. Ramesh Mendis, who himself had had a five-for in the first innings, claimed 4 for 101.
Bowling together since before lunch, they took seven wickets between them for 85 runs. One batter - Fawad Alam - had been run out, though this had also been brought about partly by the pressure these two had created.
Babar top-scored with 81off 146 balls, having earlier overturned an lbw against him on 34. It was his wicket, soon after lunch, that was the key moment - Jayasuriya getting him lbw with a straight delivery.
It was in the last half-hour before the break, though, that Sri Lanka, and the pitch, suddenly came to life. Suddenly, chances were being created, balls were dropping just short of excited close-in fielders, and a heavy pressure had descended on Pakistan.
Rizwan was the first to go, leaving a Jayasuriya delivery that was angled in from around the wicket. He did not quite believe that this straighter ball had clipped his off stump, and waited for confirmation from the third umpire, that he had, in fact, been bowled for 37 off 69.
Fawad Alam was then run-out in a horrendous mix-up for which Babar was likely to be blamed. Having made just one off his first eight balls, Fawad was keen to get off strike against Mendis. He hit a ball straight of mid-on and took off, expecting Babar to come through. Babar initially took a couple of steps, but looking over his shoulder, decided to send Fawad back even though his partner was about three-quarters of the way to the danger end. Asitha Fernando's throw found the keeper's gloves, and Fawad was not even close to making it back.
Agha Salman then played a pained six-ball innings in which it seemed every other ball might get him out. He was out off what turned out to be the last ball before lunch, as he played a paddle sweep against Jayasuriya, and ended up only hitting the ball to Kusal Mendis at short leg, who had anticipated the stroke and reacted well to pouch it, diving quickly to his right.
As long as Babar was around, though, Pakistan still had a chance of batting out a session and half, and securing a draw. Upon resumption, the bowlers were still dominant. He was dropped on 78 by Dhananjaya de Silva at slip, off the bowling of Jayasuriya. The ball had gone a distance to his left, and travelled quickly - de Silva getting both hands to it before grassing it. It didn't hurt Sri Lanka much, though, in Jayasuriya's next over, he slid one into Babar's front pad, the batter playing for the ball that turns. This time, a review would not save Babar.
Pakistan unravelled quickly after that. Mohammad Nawaz was caught at cover the following over, trying to smash Mendis against the turn. Yasir Shah bashed six boundaries and had moved to 27 off 24, before fending one to gully to give Jayasuriya his fifth wicket. Hasan Ali was bowled off a deflection trying to sweep Mendis, and Naseem Shah holed out to the same bowler, trying to clobber one over deep midwicket.
Earlier, after Imam had edged Mendis behind on 49, Babar and Rizwan had prospered square of the wicket. Having overturned an lbw decision against him on 34, Babar got to his 23rd Test fifty off the 71st ball he faced. He defended resolutely but did not allow the bowlers to deliver long strings of dots to him.
Rizwan scored almost exclusively through the leg side, meanwhile, hitting three of his six boundaries via his most productive stroke - the sweep. Only one of his 37 runs came on the offside. This was after Imam-ul-Haq had been dismissed in the third over of the day, caught behind when Mendis spun one more sharply than he anticipated.
Sri Lanka's victory means the series is levelled 1-1. While realistically, either of these teams would have had to win the series 2-0 to give themselves a chance of making the World Test Championship final, they are not out of the hunt either.
Galle defeat highlights Babar's struggle in using his spinners
Where Sri Lanka trusted Jayasuriya and Mendis to win the game for them, Pakistan always kept chopping and changing
Stats - Jayasuriya's record-breaking start, Galle's result streak, and Babar's fourth-innings form
All the important numbers from the second Test in Galle, where Sri Lanka secured their biggest win over Pakistan
Babar Azam: 'Pakistan's lower order falling cheaply was disappointing'
Sri Lanka took the last eight wickets in just 23.4 overs to secure a series-levelling win in Galle
Jayasuriya: 'I gave my everything to play for Sri Lanka'
Left-arm spinner opens up about his struggles after picking up 29 wickets in his first three Tests