Pakistan 499 for 7 (Babar 136, Imam 121, Shafique 114, Salman 10*, Zahid 1*, Jacks 3-132, Leach 2-160) trail England 657 by 158 runs
Four late wickets rewarded England for some hard graft on a pitch where runs have ruled, keeping their prospects of pushing for victory over Pakistan in this first Test alive.
Centuries to Pakistan openers Imam-ul-Haq and Abdullah Shafique as well as Babar Azam, their captain, on a Rawalpindi track that has now yielded seven centuries, had gone some way to plugging England's torrent of 657 first-innings runs at better than a run a ball. But debutant Will Jacks claimed three wickets among England's seven for the day to keep control in their hands, despite a barren middle session highlighted by Babar's classy 136.
Jacks found out only minutes before the match started that he would be playing as a replacement for Ben Foakes, who failed to recover in time from the stomach bug that hit the England camp in the lead-up. By the end of the third day, Jacks had bowled 33 overs, while his fellow debutant and part-time spinner Liam Livingstone sat in the dressing room nursing a knee injury.
Pakistan resumed on 181 without loss and Shafique, who started the day on 89, was the first to bring up his hundred, clubbing Joe Root over the deep-midwicket boundary in the fifth over of the day to move to 99 before carving the next ball behind point for a single. Imam followed, bringing up his century with a four through the leg side off Root, after resuming on 90.
It was the first time a Test match had featured two double-century opening stands and only the second time the four openers had scored hundreds, though the first time it had occurred in the first two innings.
Jacks replaced Root and his first ball of the day was pummelled through the covers by Shafique but, three balls later, Shafique tried to cut a wider one and edged behind to Ollie Pope, standing in for Foakes as wicketkeeper.
Imam launched frontline spinner Jack Leach for six over wide long-on the over after Shafique was dismissed, but Leach soon responded with the second wicket of the morning, Imam picking out Ollie Robinson at long-on to fall for 121.
While they hadn't been scoring at England's blistering rate, Pakistan's opening stand of 225 didn't look bad in comparison to the record 233 put on by Zak Crawley and Ben Duckett.
James Anderson saw a chance go begging when he found an inside edge off Azhar Ali only to see it zip through Crawley's fingers at leg slip as he reached to his left.
Despite faint hints of reverse swing, England took the new ball shortly before lunch and handed it to Leach, who trapped Azhar lbw almost immediately with one that skidded on to the knee roll in line with leg stump, giving England three wickets for the morning.
During the afternoon, however, Babar cashed in. He punished anything short, swinging Jacks powerfully through the leg side for four three times either side of his advance down the pitch to launch Leach for six over long-on and bring up his fifty.
With Root bowling wide of off stump and five fielders stationed on the off side, Babar wouldn't bite, simply stepping across and hammering the ball straight past the bowler to the boundary.
Ben Stokes entered the fray but after nailing a bouncer his next delivery, a softer short ball was met with disdain by Babar, who dispatched it down the ground to move to 90. Twice more in the space of four balls he sent Stokes short balls to the boundary, the latter flayed through the covers to bring up his eighth Test century and first against England.
In vain attempts to gain something - anything - with the ball, Root roamed round the field seeking sweaty foreheads to rub directly with the shiny side, first seizing on Leach's bald pate and then thrusting it under the raised peak of Pope's cap.
But the tea break was the tonic for England, with Robinson prising out debutant Saud Shakeel with the fourth ball after the interval, one that angled across and drew a loose edge behind to end a solid 37.
Mohammad Rizwan arrived at the crease and, after getting off the mark driving Robinson through the covers for four, helped himself to four boundaries in one Jacks over. The first came off the toe-end of the bat clearing Anderson at mid-on and was followed by three more decisive strokes, a pull and twin slog-sweeps, as he cruised to 20 all in boundaries.
It was Jacks who finally removed Babar, chipping to Leach at point, and then Anderson claimed his first when he had Rizwan caught low by Stokes at short midwicket for 29. In the fading light, England turned again to Jacks and capitalised when Naseem Shah holed out to Leach, running in from deep midwicket.