At stumps, the West Indies were five without loss in their second innings, needing a further 317 runs to reach a challenging victory total of 322.
Only one side have made more in the fourth innings to win a Test at Headingley, with Australia's celebrated 'Invincibles' scoring 404 for three at the Leeds ground in 1948 thanks mainly to opener Arthur Morris's 182 and an unbeaten 173 from Donald Bradman, widely regarded as cricket's greatest batsman.
West Indies did make 344 for one to beat England in a Test at Lord's in 1984, with opener Gordon Greenidge making 214 not out, but they will likely need a similarly brilliant innings from one of their current top order if they are to level this three-match series at 1-1.
It was fresh evidence of England's batting strength in depth that No 8 Ali top-scored and put on 117 for the eighth wicket with No 9 Chris Woakes, the recalled all-rounder himself making 61 not out before England captain Joe Root declared with his side on 490 for eight.
That left the West Indies with a tricky six overs to bat until the close but openers Kraigg Brathwaite and Kieran Powell survived.
The whole day's play represented a remarkable turnaround in the match given the West Indies had a first-innings lead of 169 runs -- a testament to a vastly improved batting and bowling, if not fielding, display after their embarrassing innings and 209-run defeat in the first Test at Edgbaston.
Fast bowler Shannon Gabriel proved expensive, however, on Monday, his 26 overs costing 125 runs -- including nine wides and 10 no-balls.
England had started Monday's play just two runs ahead and already three wickets down.
But brisk fifties from Root (72)-- his second of the match on his Yorkshire home ground -- and Ben Stokes (58), following up his first-innings score of exactly 100, plus a painstaking 61 from Dawid Malan laid the platform for Ali's late-order assault.
Left-handed batsman Ali faced just 93 balls and hit 14 fours.
- Ali reprieve -
A dispiriting day for the West Indies was summed up when Ali was reprieved on 32.
He bottom-edged a catch off leg-spinner Devendra Bishoo and was superbly caught by wicket-keeper Shane Dowrich only for Indian umpire S Ravi to make a desperately tight no-ball call.
It seemed almost cruel that the West Indies, who had dropped several catches this Test at a potentially match-losing cost of 238 runs, should have their best effort of the game chalked off this way.
Ali, whose elegant cover-driven four off Gabriel saw him to fifty, holed out off Bishoo in sight of his sixth Test hundred.
Off-spinner Roston Chase (three for 86) removed Stokes, Malan and Jonny Bairstow in quick succession before tea but that simply paved the way for Ali and Woakes's quickfire stand.
England resumed on 171 for three after the West Indies had made 427 in their first innings following hundreds from Shai Hope (147) and Brathwaite (134).
Root, dropped in the gully on 10, was 45 not out and Malan, who had a lucky break on four when the West Indies opted against reviewing a potential catch, was unbeaten on 21.
Root, dropped on eight en route to 59 in England's first-innings 258, completed his second fifty this Test in 87 balls after he edged two fours off Kemar Roach.
But the breakthrough the West Indies so badly needed came when Root, cramped for room trying to cut Gabriel, steered the ball to gully where Shai Hope, succeeding where brother Kyle had failed on Sunday, clung on to a juggled catch.
But first slip Powell missed Malan, then on 32, although the blame lay with wicket-keeper Dowrich for bailing out late on.
First Published: August 28, 2017, 11:51 PM IST