Allrounder's unbeaten 67 means visitors already require record run chase to draw series in Manchester.
Moeen Ali puts England on brink of Test series victory at Old Trafford
Moeen Ali's sparkling strokeplay in his undefeated 67 put England in total control of the fourth Test with a lead of 360 over South Africa at Old Trafford.
England ended a third day curtailed by early evening rain on 224-8 and, with two full days remaining, will be confident of wrapping up a 3-1 series win.
Although the comfort of their first-innings lead meant there would have been few nerves in the England dressing room, the hosts were struggling at 134-6 when Moeen walked to the crease.
Jonny Bairstow, whose first-innings 99 had been key to England's lead, soon departed for 10, leaving Moeen with only the lower order for support.
England had struggled against the spin of Keshav Maharaj who was making the most of the rough outside off-stump to the left-handed batsmen.
But Moeen took the game to the left-arm spinner, putting on a 58-run partnership with Toby Roland-Jones and eliminating the concern over the rough with positive footwork.
Three times Moeen hit Maharaj for six and his confidence, shot selection and execution raised the question of why he is batting down at number eight.
After Roland-Jones departed, top-edging as he tried to pull Kagiso Rabada, Stuart Broad joined Moeen and the pair will resume on Monday after rain cut play short in the final hour.
South Africa's first-innings batting had left them with an extremely difficult task but their bowlers were not intent on ending the series without a fight.
Paceman Morne Morkel got the early breakthroughs, striking twice before lunch.
Alastair Cook went in the seventh over, attempting a cover drive, but his thick edge flew to Theunis de Bruyn, who comfortably pocketed the catch at gully.
Tom Westley went in similar fashion, edging to substitute fielder Aiden Markram, who held on at a gully to leave England on 30-2.
After lunch, England opener Keaton Jennings, who has struggled throughout the series and was badly in need of a good score, departed for 18, making a mess of a short delivery from Rabada to give Hashim Amla a simple catch at first slip.
England skipper Joe Root looked composed and confident again but fell one run short of his half-century after dragging on a low delivery from Duanne Olivier.
Olivier had his tail up, causing problems with his clever right-arm medium-fast deliveries and after troubling Stokes outside the off-stump on several occasions, he got his reward when the England batsman edged to skipper Faf du Plessis at first slip.
Broad had earlier claimed the final wicket of South Africa's first innings.
Olivier's attempted pull ended in a top-edge which was safely gathered by keeper Bairstow.
James Anderson ended with his best figures in a test on his home ground of 4-38 in 17 overs.