Abu Dhabi - Sri Lankan spinner Rangana Herath returned with five wickets but a half century from Haris Sohail on his debut saw Pakistan take a three-run lead on the fourth day in the first Test in Abu Dhabi on Sunday.
The wily left-armer finished with 5-93 in a marathon 40 overs but left-hander Sohail fought through his 76 run knock to take Pakistan to 422 all out in reply to Sri Lanka's first innings total of 419.
The slow turn on a flat wicket means the Test heads for a draw unless Sri Lanka flop in the second innings.
Sohail added an invaluable 50 for the ninth wicket with tail-ender Hasan Ali to lift Pakistan from 340-8 and deprived Sri Lanka of a healthy lead.
Sohail hit seven fours and two sixes before holing out to paceman Nuwan Pradeep who finished with 2-77.
Herath gave his team the much-needed wicket of a resolute Ali, luring him into an uppish drive which was brilliantly caught at short mid-wicket by a diving Kusal Mendis.
Azhar's defiant knock lasted more than five hours and included four boundaries, but with his dismissal Pakistan's hopes of building a lead faded.
Hasan whirlwind 25-ball 29 had three sixes and two boundaries.
Paceman Suranga Lakmal then came into his own, bowling Pakistan skipper Sarfraz Ahmed off an inside edge for 18 before trapping Mohammad Amir leg before for four.
Lakmal finished with 2-42.