Pakistan have been left requiring 263 runs to record one of the most famous Test victories in history against England in Rawalpindi.
Having scored 657 in their first innings, breaking numerous records in the process, England appeared to be in a position where a draw would be a worst-case scenario.
The tourists held a lead of 78 runs at the midway point, Pakistan making 579 runs in their reply, but a rapid 264 during the middle part of Sunday led to England opting to declare, setting their hosts a target of 343.
England initially made quick inroads to seize control, but an unbeaten 55-run partnership between Imam-Ul-Haq and Saud Shakeel has swung the contest marginally in Pakistan's favour.
After taking 101 overs to score 657 runs at the start of the match, England required over 155 overs to dismiss Pakistan for 579, the contribution of Will Jacks proving key as he ended with figures of 6-161.
With an advantage of 78 runs, the game was set up for England to bat aggressively, and although they lost Ben Duckett and Ben Stokes to first-ball ducks, they proceeded to hit 264-7 off just 35.5 overs.
Zak Crawley made 50, Joe Root scored 73 at a similar rate and Harry Brook hit a majestic 87 from 65 deliveries before his wicket led to a surprise declaration with four sessions still remaining.
The decision followed England's recently-installed approach of risking defeats in chasing victories, and the latter appeared more likely when Pakistan were reduced to 25-2 due to wickets for Ollie Robinson and Ben Stokes.
However, despite Azhar Ali also having to retire hurt after just two balls due to a hand injury, Ul-Haq and Shakeel would eventually put on an unbeaten 55 from 14.3 overs.
Although a further 263 runs are still required, Pakistan have to be regarded as favourites to pull off the previously-deemed unthinkable win, leaving England as the team under pressure ahead of the final day.