But off-spinner Ali, so often a thorn in South Africa's side this series, took three wickets for five runs in 11 balls including the prize scalp of Hashim Amla, who made a defiant 83.
At tea, South Africa, already 2-1 down in this four-match campaign, were 182 for six -- still needing a further 198 runs to reach a huge victory target of 380.
Ali had figures of three for 54 in 16 overs.
That gave him 23 wickets in a series where he'd also scored 252 runs -- including 75 not out earlier Monday.
Sunday had seen Ali become the first England cricketer to score 200 runs and take 20 wickets in a series since Andrew Flintoff performed the feat during the 2005 Ashes.
Faf du Plessis, the Proteas captain and the last of their specialist batsmen, was 60 not out with Keshav Maharaj three not out.
Amla put on 123 for the fourth wicket with du Plessis, who played at Old Trafford for Lancashire, as the Proteas fought back from 43 for three at lunch.
But shortly before tea, with South Africa 163 for three, Amla missed an intended whip shot off Ali and was lbw, although England, for the second time Monday, had to first review umpire Kumar Dharmasena's original not out decision.
No replays were required when Quinton de Kock (one) edged a drive off Ali to Alastair Cook in the slips.
And 173 for five became 173 for six when Theunis de Bruyn fell for a duck, nicking Ali to slip fielder Ben Stokes.
But both of those records looked like taking a dent after they were set a huge target -- no side have made more to win in the fourth innings of a Test at Old Trafford than England's 294 for four against New Zealand in 2008.
South Africa's already difficult task was not helped when they lost both openers to be 18 for two.
Dean Elgar, who made a gritty second-innings hundred in England's 239-run victory in the third Test at The Oval, fell for five on Monday when caught behind off Stuart Broad.
Heino Kuhn, struggling to cement his Test place, repeatedly played and missed before, on 11, edging James Anderson, again bowling from the newly-named James Anderson End, to Cook.
Temba Bavuma again battled hard until, from the last ball before lunch, he was given out caught behind on review off Toby Roland-Jones.
Amla completed a 100-ball fifty with his ninth four, a pull off Stokes.
He then twice forced Stokes off the back foot for two stylish offside fours before driving Ali for six.
Earlier, England were bowled out for 243 in their second innings after resuming on 224 for eight.
Ali, dropped on 15 by Elgar at slip, took his overnight 67 to 75 not out before fast bowler Morne Morkel wrapped up the innings on his way to four for 41.
Worcestershire all-rounder Ali faced 66 balls, including nine fours and three sixes.