Babar Azam scored the seventh century of the match but England's persistence paid off as they took four wickets in the final session on day three of the first Test against Pakistan.
Imam-ul-Haq (121) and Abdullah Shafique (114) completed their hundreds in the morning session at Rawalpindi Cricket Stadium before their opening stand came to an end with 225 on the board.
Captain Babar (136) got in on the act with a typically stylish innings, but Pakistan closed on 487-7 in reply to the tourists' 657 all out – trailing by 160 runs.
Debutant Will Jacks took 3-123 and Jack Leach claimed 2-158 on a flat wicket, England earning late rewards for toiling in the heat after Pakistan avoided the follow-on.
Spinning all-rounder Jacks got the breakthrough after Pakistan resumed on 181 without loss, Shafique edging a wide delivery through to wicketkeeper Ollie Pope.
Imam holed out trying to launch Leach over the rope and Pakistan were 283-3 at lunch after the left-arm tweaker trapped Azhar Ali (27) leg before.
Babar and Saud Shakeel prevented any further damage from being done in a wicketless afternoon session, the skipper serenely scoring another century he brought up by dispatching Ben Stokes through the covers for four.
Ollie Robinson struck in the first over after tea, though, debutant Shakeel nicking the seamer behind for 37, and Babar ended a fifth-wicket stand of 60 with Mohammad Rizwan by slapping Jacks to Leach at point.
Rizwan (29) became James Anderson's first victim and Naseem Shah struck a well-flighted Jacks delivery to Leach in the deep as England ended the day strongly.
Openers make history in run-fest
All four opening batters made centuries in the same match for only the second time in a Test – and this was the first time that each of the four reached three figures in the first innings.
It was also the first occasion in which there have been two double-century opening stands in a Test.
Imam made his third hundred in as many Test knocks in Rawalpindi, having scored one in both innings against Australia in March. Shafique has three Test centuries in only 14 innings.
Babar delivers another masterclass
Skipper Babar made his eighth Test hundred and a first against England with yet another masterclass.
The elegant right-hander showed a combination of sweet timing and aggression in a stylish knock that we have become so accustomed to seeing.
Babar has scored three Test hundreds and four half-centuries this year in 10 Test innings, hitting one six and 19 fours in his latest exhibition of batting of the highest order.