Pakistan 226 and 27 for 1 (Hafeez 8*, Azhar 6*) trail Sri Lanka 337 (Paranavitana 75, Perera 75, Samaraweera 73, Junaid 5-70) by 84 runs
Scorecard and ball-by-ball details

Sri Lanka took a significant step in their attempt to thwart Pakistan from levelling this rain-affected series, through a combination of dogged batting on a testing pitch, a fair amount of luck, and aggression. Pakistan contributed much to that luck through sloppy fielding, when an urgent quest for wickets was the need of the hour after a rained-out second day.

A century-stand between Tharanga Paranavitana and Thilan Samaraweera included a period of survival during a hostile morning spell from Pakistan's seamers, as the two overcame their lean runs in this series. Thisara Perera's counterattack against the second new ball restored a sense of security for Sri Lanka - it stretched their lead to 111 - and gave them a strong opportunity to force a win.

Pakistan's two crucial lapses in the field occurred in the slips, from two unlikely candidates. Younis Khan spilled a straightforward chance at second slip when Samaraweera was on 49 - that partnership with Paranavitana was to last another 38 runs and 16.1 overs - and Misbah-ul-Haq dropped a simple catch off Perera, on just 22. Umar Gul was the aggrieved bowler on both occasions, and was left dispirited when the batsman his captain reprieved returned the favour with what could be a game-changing onslaught.

Gul bowled one half of Pakistan's incisive, though wicketless, morning spell; from the other end Junaid Khan threatened, probed and eventually picked up his third five-for - all of them have come against Sri Lanka.

In conditions where the advantage to fast bowlers was not as pronounced as on the first day, but with enough swing and movement to trouble the batsmen, Junaid's battle against Samaraweera was exciting to watch. Junaid, with his round-the-wicket angle, tried hard to beat Samaraweera through the gate by moving it back in, but the batsman countered that by stepping outside the line and moving forward. He was beaten on occasion and struck high on the pads once, but the ploy was largely effective - except when Junaid slipped in the away-going delivery after angling it in, confounding the batsman completely.

Paranavitana, possibly competing for his place in the side, needed the luck he got. He survived a close call for lbw against Gul on the first day, and was in for a stern test from the same bowler on the third. A sharp, pacy, incoming short delivery rapped him on the back of the bat and flew over the slips, and a couple of attempted drives to initiate a counter-attack went past the edge, immediately prompting his senior partner to calm him down.

Gradually, though, the pair found their feet, painstakingly extending their partnership. Paranavitana finally managed to drive Gul through cover, Samaraweera played Junaid down the ground and the two were far more comfortable when Mohammad Sami and Ajmal were called on to bowl. Though he got a couple of doosras past the edge, Ajmal struggled to turn his conventional offbreak, often met with a full face from the batsmen. Sami was quick, but bowled short and provided too much width. Paranavitana smashed Younis Khan through point to reach his half-century, and appeared a more confident player after lunch, driving Junaid and Gul elegantly through cover for boundaries.

It was after a brief rain interruption that Ajmal, ineffective up to that point, went round the wicket and got a ball to turn in from off stump. Samaraweera played forward, was beaten and trapped in front. A loose shot from Angelo Mathews off a wide ball from Junaid had him caught at gully, before Paranavitana dragged on a short ball from Ajmal three overs later. Gul struck first ball with the second new ball to remove Prasanna Jayawardene. Sri Lanka led by 10 at that point with seven down, but their depth in batting ensured they added 101 more.

Nuwan Kulasekara is a capable batsman and thrashed Gul twice through the covers, one an imperious drive on bended knee. As Gul bowled length, Perera - also a beneficiary of a difficult, dropped return catch and a missed run out - launched him through mid-off and cover for fours before dispatching a slower one over the midwicket for six in the same over. Junaid returned to dismiss Kulasekara - by which time the stand with Perera was worth 84 - but Perera signed off by swinging Ajmal for two big sixes over midwicket and long-on before becoming Junaid's fifth victim.

A rare error from umpire Simon Taufel didn't help Pakistan's case when they came out to bat, as Taufeeq Umar was given out lbw to a delivery that pitched outside leg stump. It capped a day that began with much promise for Pakistan in helpful conditions, but their own shortcomings and a determined opposition left them targeting, at least for a good part of the fourth day, survival and not a push for victory.

Siddhartha Talya is a senior sub-editor at ESPNcricinfo