Sri Lanka 315 need 152 runs to beat Pakistan 138 and 329 (Azhar 117, Shehzad 69, Prasad 4-92, Chameera 3-53)
Scorecard and ball-by-ball details
Fast bowler Dhammika Prasad's 4 for 92 helped Sri Lanka pull ahead in the second Test as they dismissed Pakistan for 329 to leave them needing 153 to draw level in the three-match series. His bowling also blunted the impact of Azhar Ali's ninth Test century, which had anchored Pakistan, helping them wipe out a significant deficit and then putting them in the lead. Sri Lanka's chase, however, will only get underway on the final day after heavy rain wiped out the entire third session.
Prasad reaped rewards for his discipline and accuracy and played an important role in breaking the overnight partnership between Younis Khan and Azhar at the start of the day, inducing edges from both batsmen. His accuracy helped unsettle Younis Khan who eventually fell caught behind to Angelo Mathews for 40 with a half-hearted edge. That wicket brought an end to a 73-run partnership between Younis and Azhar, but with the score at 202 for 3, Pakistan still had a chance to build a larger total. Instead, the rest of the line-up failed to bat long enough with Azhar to leave an impact. The side lost their last six wickets for 55 runs.
The wickets came just as the batsmen began settling down. Misbah-ul-Haq was on 22 when he was trapped in front by Prasad, soon after Sri Lanka had taken the new ball. Misbah reviewed but replays showed the ball clipping the top of the stumps. After Asad Shafiq turned Dushmantha Chameera into the keeper's hands down the leg side, Prasad got the wickets of Sarfraz Ahmed and Yasir Shah in successive overs. The Pakistan wicketkeeper was caught behind at the start of a fresh spell, and Yasir was yorked for an 11-ball duck.
Prasad did slip in a few loose ones down the leg side and attempted yorkers that ended up as full tosses but he was beating the batsmen regularly, drawing them forward with length and fuller deliveries, while mixing the odd short delivery. He kept the pressure up through an extended second session, peppering the Pakistan tail-enders with quick yorkers. His returns in the second innings took his match haul to a career-best seven wickets.
Rangana Herath delivered a big blow when he drew Azhar out of his crease a tad early. The batsman was left stranded down the pitch when Chandimal whipped the bails off, ending his innings at 117, which had only six fours.
The tone and pace of his innings on the fourth day was similar to the way he played during the 120-run partnership with Ahmed Shehzad on day three. There weren't too many boundary balls on offer, and with a slow outfield, it became imperative for Azhar to turn the strike and ensure the side was not bogged down. He continued doing that even as wickets fell around him, but he was also lucky to be given a few reprieves. In the fourth over of the day, he came close to being dismissed on 68 when Prasad drew him forward, but the edge - more a keeper's catch - was dropped by Kumar Sangakkara at first slip. A few edges in the first session also fell short of fielders.
Azhar raised his century with a punch through mid-off for two off Chameera. It was also his fifth Test century against Sri Lanka.

Rachna Shetty is a senior sub-editor at ESPNcricinfo