Pakistan's attempts to bat their way back into the second Test in Colombo have been dealt a major blow after Sri Lanka bowled the tourists out for 329, leaving Sri Lanka with a target of 153 to win.
Dhammika Prasad was the chief architect for Sri Lanka as he took two crucial wickets in quick succession to turn the tables back in the hosts' favour.
Dushmantha Chameera had Asad Shafiq caught behind by Dinesh Chandimal early on in the session as Pakistan started to lose control of their second innings.
However, Azhar Ali, who had earlier been dropped by Kumar Sangakkara at first slip, steadied the ship when he reached his hundred with a punched shot through mid-off just two overs later.
Sarfraz Ahmed took Pakistan past the 300 when he prodded a full ball from Tharindu Kaushal through the covers, but Sri Lanka then brought Prasad into the attack.
With his first ball of the spell, Prasad tempted Sarfaz down the wicket and he carelessly edged to Chandimal to reduce Pakistan to 301-6.
Prasad then struck again when he bowled Yasir Shah for a duck with a yorker to put another dent in Pakistan's fightback.
However, it was Rangana Herath that dismissed Pakistan's key man as he ended Ali's charge when he had him stumped by Chandimal for 117.
Junaid Khan was caught by Chandimal off the bowling of Chameera, before Wahab Riaz was trapped lbw, again by Chameera, to end Pakistan's resistance.