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-off 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 dangerous 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 left.
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.