Jos Buttler struck a blistering 80 not out before James Anderson took two wickets as England closed on a series-levelling win against Pakistan in the second Test at Headingley on Sunday.
Pakistan were 48 for three in their second innings at lunch on the third day, still 141 runs behind England's first-innings 363.
Imam-ul-Haq was 16 not out and Test debutant Usman Salahuddin two not out after the tourists thrashed England by nine wickets in the first match of this two-Test contest at Lord's.
England resumed on 302 for seven, a lead of 128 runs, with Buttler 44 not out and Sam Curran, unbeaten on 16.
Curran, however, was out for 20 on his 20th birthday when he was well caught low down at second slip by Shafiq off Mohammad Abbas.
At this stage, no batsman in the innings had scored a fifty, although Dominic Bess had made a commendable 49 in his role as nightwatchman.
Buttler, dropped on just four on Saturday when Hasan Ali failed to hold a straightforward chance at midwicket, soon altered that statistic.
He went to fifty in style with two boundaries in as many balls off paceman Mohammad Abbas — an extra-cover driven four followed by a hooked six into the site where the Football Stand is being rebuilt.
Buttler was missed in the deep by Salahuddin on 66, the ball going for four. The very next ball saw Buttler drive medium-pacer Faheem Ashraf for six over long-on.
But with Buttler five runs short of equalling his Test-best 85, made on debut against India at Southampton in 2014, No 11 Anderson was caught in the slips off Hasan Ali.
Buttler faced 101 balls, including 11 fours and two sixes.
Azhar Ali struck the first ball of Pakistan's second innings, from Anderson, through extra-cover for four. But Anderson, England's all-time leading Test wicket-taker, bowled Azhar for 11 when the batsman played
And Pakistan were 30 for two when Haris Sohail (eight) saw a hard-hit drive off Anderson brilliantly caught one-handed by a diving Bess at extra-cover.
Any hope Asad Shafiq, one of Pakistan's more experienced batsman, might steady the innings ended when he was given out on review for five after a thin glove down the legside off Stuart Broad was caught down the legside by wicket-keeper Jonny Bairstow.
Anderson had lunch figures of two for 23 in five overs.