Pallekele: Jul 11, 2012
Azhar was unbeaten on 97 as Pakistan went to tea on the fourth day at 210-4 in their second innings, just 99 runs ahead with six wickets in hand.
Pakistan's last recognised batting pair of Azhar and Asad Shafiq (16 not out) were at the crease, with prospects of a series-levelling win dimming for the tourists.
Sri Lanka, who won the first Test in Galle before the second in Colombo was drawn, need only a draw to secure their first series victory in three years since beating New Zealand 2-0 at home in 2009.
Azhar, who made 157 in the Colombo Test, held the innings together for close to five hours, hitting nine boundaries as he approached his fourth Test century.
The right-hander put on 94 for the second wicket with his overnight partner Mohammad Hafeez and 48 for the third with Younis Khan after Pakistan resumed the day at 27-1.
Hafeez, who also hit a century in Colombo, made 52 when he was dismissed just before lunch with Pakistan two runs away from wiping out the first innings deficit of 111 runs.
The Pakistan vice-captain edged a wild drive off fast bowler Dilhara Fernando to Tharanga Paranavitana in the slips.
The wicket of Hafeez came against the run of play after Sri Lanka's bowlers failed to contain the flow of runs on a pitch that appeared to ease out under bright sunshine.
Pakistan went to lunch at 119-2, in front by eight runs, after Younis had given his team the lead by tapping Angelo Mathews for a single to point.
Wicket-keeper Prasanna Jayawardene dropped a low catch when Younis, then on 12, followed a wide ball from Angelo Mathews.
But the missed chance did not prove costly as Younis managed to add just seven more runs when he was snapped up by a lunging Paranavitana at silly-point off Rangana Herath.
The left-arm spinner then removed skipper Misbah-ul Haq for five, the batsman giving his Sri Lankan counterpart Mahela Jayawardene an easy catch in the slips to make Pakistan 176-4. (AFP)
Brief Scores: Pakistan 226 & 210 for 4 (Azhar Ali 97*, Mohammad Hafeez 52; Rangana Herath 2 for 44) lead Sri Lanka 337 (Tharanga Paranavitana 75, Thisara Perera 75, Thilan Samaraweera 73; Junaid Khan 5 for 70) by 99 runs.