Andrew Fidel Fernando is ESPNcricinfo's Sri Lanka correspondent. @afidelf
BAN v IND (1)
AUS v WI (1)
BDESH-W in NZ (1)
CWC League 2 (1)
NZW-U19 in IND (1)
Pakistan 218 (Babar 119, Jayasuriya 5-82) and 344 for 6 (Shafique 160*, Babar 55, Jayasuriya 4-135) beat Sri Lanka 222 (Chandimal 76, Shaheen 4-58) and 337 (Chandimal 94*, Kusal Mendis 76, Oshada 64, Nawaz 3-88) by four wickets
A tense final morning, in which Pakistan had 120 to get with seven wickets in hand, began with the closest call. Mohammad Rizwan, coming forward to a Prabath Jayasuriya delivery, saw the ball slip between bat and pad before passing within a couple of centimetres of the off bail.
There were plenty of other moments to fray Pakistani nerves. In the third over, Abdullah Shafique was hit on the back leg by Jayasuriya, raising a voracious lbw appeal. Sri Lanka reviewed the not-out decision, but the ball was shown to be climbing over the stumps. Several overs later, once Pakistan had whittled the requirement down to double figures, another Jayasuriya ball that passed Rizwan's outside edge prompted another big appeal, and another burned review.
When he was on 128, Shafique thought a ball that erupted from a length and beat the keeper had gone towards the boundary, and began to take off for a run, before hastily turning back. Had Dhananjaya de Silva, who had caught that ball at slip, connected with his shy at the stumps, Shafique would have been out.
And then there was the rain. A large black cloud parked itself over the stadium when Pakistan had about 25 to get. Not willing to let his almost 400-ball innings end in a rain-affected draw, Shafique came down the pitch and tried to launch Dhananjaya de Silva over deep midwicket, and only ended up skying it to Kasun Rajitha, who came in a few metres off the boundary and dropped it.
But through all this, though three wickets fell, and though Pakistan had to scrap for the last 40 runs, Shafique's continued presence meant that they always had the chase in hand. He largely batted on day five much like he had the previous day - watchfully, strategically, and with a staunch refusal to give away his wicket.
In the early parts of the day, he had let Rizwan spur Pakistan forward with his sweeps, and a couple of breezy cover drives. During their partnership of 71, which put Pakistan within 65 runs of victory, Shafique made only 23 runs, and struck just the solitary boundary. Rizwan made 40, and was eventually out lbw to a Jayasuriya slider.
With the lower-middle-order batters, Shafique was no different, sticking with the strategy of waiting out the good balls, and creating single options, occasionally by coming down the track, or by going deep into his crease.
When debutant Agha Salman and Hasan Ali - who had been promoted to hit some big shots - were out in quick succession with 41 still to get, Shafique was still resolute. Only in that final stand with Mohammad Nawaz (of the ones he was involved in, on day five), did Shafique outscore his partner, passing 150 for the first time in his career, with 25 still to get.
The final obstacle in Pakistan's way was the rain. With 11 required, the dark cloud that had forced a hurried shot out of Shafique unleashed a torrent. But the heavy rain lasted only minutes, and it soon became clear that play would resume, which it did following a delay of about 90 minutes. Shafique fittingly hit the winning runs, a slap through the covers to take him to 160 not out off 406.
Of Sri Lanka's attack, Jayasuriya seemed for large parts of the day to be the only bowler capable of taking wickets, with Ramesh Mendis unable to exert consistent pressure, while Maheesh Theekshana was milked for runs as well. Dhananjaya de Silva assisted Jayasuriya the best with some quiet overs.
If last week's innings win against Australia had made Sri Lanka confident in their spin attack, this chastening defeat has been a reality check. This remains an inexperienced group. Jayasuriya was the best of them again, taking 4 for 135 from 56.2 overs. Ramesh Mendis and Dhananjaya claimed a wicket apiece.
SLC invites ICC Anti-Corruption Unit to investigate match-fixing allegations made in parliament
MP Nalin Bandara claimed that the first Sri Lanka-Pakistan Test in July had been fixed, and said the board had become "a gambling den"
Pinch yourself, Pakistan; Abdullah Shafique is a real, living, breathing opener
For a country infamous for its opening woes, Shafique doesn't just feel like the right answer, but an entire exam being aced
Babar: Shafique can become 'one of the best' in the world
Pakistan captain praises his opener for showing his "class and temperament" in "difficult conditions"
Shafique's marathon knock, Pakistan's record chase, and Jayasuriya's dream start
Highlights of Pakistan's incredible win, which was the highest successful chase in Galle