With Sri Lanka scoring 138 in their second innings, it set Pakistan a target of 136 to win. The technology returned a verdict of "umpire's call", which no longer sees the unsuccessful team lose one of their two reviews per innings.
For Sri Lanka, wicketkeeper batsman Niroshan Dickwella was the leading run scorer, he remained not out on 40, as his side collapsed on 138.
Openers Shan Masood and Sami Aslam also struck half-centuries to lift the designated hosts to 266 for four at the close, trailing Sri Lanka's first-innings 419 by 153 runs, making a draw the most likely outcome.
"They played some really good cricket and I'm sure this can continue throughout the series". Asad Shafiq shaped to cut a Herath delivery bowled shorter, and a little quicker, but managed only to send it to slip.
Earlier, Pakistan took a three-run first-innings lead after reaching 422 all out.
Suranga Lakmal and Rangana Herath took 2 and 5 wickets respectively to dismiss the Pakistani side.
Meanwhile Sri Lankan spinner Rangana Herath achieved a colossal feat during the game.
With the ball taking spin on a hard Sheikh Zayed Stadium pitch, Pakistani batsmen struggled against veteran left-arm spinner Rangana Herath (2-19) and off-spinner Dilruwan Perera (2-25).
Pakistan head coach Mickey Arthur rued the fact that the team could not go over the line in the first Test against Sri Lanka recently.
The Sri Lankan spin maestro Rangana Herath was exceptional after he picked six for 43 runs. Bringing it up in mere 84 innings, Herath stands third on the list of 'Fewest Tests to 400 wickets behind Muralitharan (79) and Richard Hadlee and Dale Steyn (80).
Pakistan are 5/4 with Sky Bet for victory, Sri Lanka can be backed at 4/1 and the draw is on offer at 6/5. "We were always going to be under pressure as the game goes on because we couldn't expect the tail to get us over the line", quoted Mickey Arthur as per the quotes in Cricbuzz. Sri Lanka can be backed for the win at 7/4 and the draw is on offer at 3/1.
Dilruwan Perera replaced Dickwella and took 33 balls to get off the mark.
Pakistan captain Sarfraz Ahmed called the defeat "disappointing".
Dilruwan ended with 3 wickets, but the stage was set on fire by Herath who took the game by the horns and made a decision to turn the match in the favor of his team on the final session on the final day. I was so happy with the remarkable achievement (400 wickets).
"We knew once we got that much, we have our legend [Herath] here".