Azhar Ali's century helped keep England at bay before he was out to the final ball of the second day of the third Test at Edgbaston on Thursday.
Azhar's more than six-hour 139 ended when all-rounder Chris Woakes, on his Warwickshire home ground, struck with the new ball to have him edging to England captain Alastair Cook at first slip.
That left Pakistan 257 for three at stumps, 40 runs behind England's first innings 297.
Number three Azhar had come in just five balls into Thursday's play after Mohammad Hafeez had fallen for a duck to leave Pakistan none for one.
Azhar punished England for dropping him twice with his 10th century in 48 Tests.
Together with recalled opener Sami Aslam, who made 82, he put on 181 for the second wicket.
Aslam, a 20-year-old left-handed opener, was in sight of a well-deserved maiden Test hundred when he was run out responding to Azhar's poor call.
Younis Khan was 21 not out, having helped Azhar add 76 for the third wicket.
England's tough day in the field was made worse when James Anderson was twice warned officially in one over by Australian umpire Bruce Oxenford for running on the pitch.
One more such warning and Anderson, England's all-time leading Test wicket-taker, would be barred from bowling again in the innings.
Hafeez fell for a duck after lazily guiding a short Anderson delivery to Gary Ballance at point.
Pakistan had seen Sohail Khan, one of their two changes from the side beaten by 330 runs in the second Test at Old Trafford as England levelled the four-match series at 1-1, take a Test-best five for 96 on Wednesday.
- Composed Aslam -
Now all eyes were on Aslam, also playing just his third Test, after he had replaced struggling fellow left-handed opener Shan Masood.
Aslam's only prior innings this tour was his 17 against Worcestershire during last week's two-day warm-up match.
Yet the well-organised opener played with a composure belying his years.
Azhar showed his class by turning Anderson off his legs for four.
Pakistan were still on their lunch score of 72 for one, with Azhar on his interval total of 38 not out, when the right-hander's flashing drive off Anderson was dropped by Joe Root at second slip.
Azhar's cover-driven three off fast bowler Steven Finn saw him to a 129-ball fifty, including six fours.
Meanwhile Aslam swept off-spinner Moeen Ali for four, to complete a maiden Test fifty in 135 balls with five boundaries.
Azhar almost fell to Ali on 68, but the bowler was unable to hold a tough return chance above his head off a hard-hit drive.
The corresponding Test at Edgbaston in 2010 saw Pakistan dismissed for just 72 in their first innings, with Azhar's contribution a 32-ball nought.
But at Thursday's tea they were 154 for one, with Aslam 69 not out and Azhar unbeaten on 72.
After the break, both batsmen drove Ali, who posed few problems in 15 wicketless overs that cost 63 runs, for a straight six.
But with England on the ropes, a self-inflicted wound saw Aslam run out.
Azhar poked Woakes into the offside and set off for a non-existent single, with the luckless Aslam dismissed by James Vince's direct hit from cover.
Pakistan were now 181 for two, with Aslam having faced 176 balls including nine fours and one six in a partnership spanning 62 overs.
This innings comfortably surpassed Aslam's previous Test-best of 20 against Bangladesh in Khulna last year.
Azhar's ungainly pulled four off paceman Stuart Broad saw him to his second Test century against England in 209 balls.
In what has become a familiar sight this series, the 31-year-old Azhar celebrated with several press-ups -- a tribute to the Pakistan Army staff who helped the squad get fit during a pre-tour 'boot camp'.
But Woakes's last-gasp effort took the shine off Pakistan's day.
Published Date: Aug 05, 2016 12:50 am | Updated Date: Aug 05, 2016 12:50 am