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.
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.
More From This Section
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, today, his 26 overs costing 125 runs - including nine wides and 10 no-balls.
England had started today's play just two runs ahead and already three wickets down.
Left-handed batsman Ali faced just 93 balls and hit 14 fours.
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.
Ali, whose elegant cover-driven four off Gabriel saw him to fifty, holed out off Bishoo in sight of his sixth Test hundred.