South Africa were 220 for nine in reply to England's first innings 362, featuring Jonny Bairstow's 99, at stumps on the second day.
That left them with a deficit of 142 runs in a match they have to win to draw this four-match series 2-2.
Morne Morkel was 18 not out after Kagiso Rabada (23) was brilliantly caught by a diving Ben Stokes in the gully off Stuart Broad in what became the last ball of the day.
The 35-year-old was now in sight of his first five-wicket haul in a Test innings at Old Trafford.
Also Read
But his seventh Test at Old Trafford was the first fixture since what was known as the Pavilion End had been renamed in honour of Anderson, England's all-time leading Test wicket-taker.
Anderson needed just three balls to strike when Dean Elgar, fresh from a hundred in South Africa's 239-run defeat in the third Test at The Oval, was lbw for a duck in the first over of the Proteas' reply.
But for the third time in as many innings, he fell to Toby Roland-Jones after the Middlesex paceman had twice removed him cheaply on his Test debut at The Oval.
Amla glanced Roland-Jones off his pads for four only to fall next ball when, trying to play a similar shot to a worse delivery, he was caught down the legside by wicket-keeper Bairstow.
South Africa then sent in Temba Bavuma rather than Quinton de Kock, who had been batting at number four this series.
But with a sunny day and good pitch offering some of the best batting conditions this series, struggling opener Heino Kuhn and Bavuma got bogged down.
But two balls after a near run out, Kuhn edged off- spinner Moeen Ali to Stokes at slip on 24.
Bavuma battled hard for 46 before becoming the latest Proteas batsman to be out playing no shot this series, leaving an Anderson delivery that clipped the top of off stump.
And when South Africa captain Faf du Plessis fell for 27 via an inside edge onto his stumps, Anderson had taken two for one in three balls to reduce the Proteas to 132 for five.
Ali followed up with his 20th wicket of the series, surpassing his previous best of 19 at home to India in 2014, when Keshav Maharaj was plumb lbw.
De Kock had dropped opposing gloveman Bairstow on 53, a costly error, but there was no returning the favour when the left-hander nicked Stuart Broad to the Yorkshireman on 24.
England resumed on 260 for six after winning the toss.
Bairstow was 33 not out, having survived a contentious umpire review for a slip catch when he'd made a mere four runs.
But he should have gone for 53 only for de Kock to drop a low diving chance off Rabada.
Bairstow, with just last man Anderson for company, cashed in amid a blizzard of boundaries that included a straight six off Duanne Olivier.
But in sight of what would have been a fourth Test century, Bairstow was lbw trying to sweep left-arm spinner Maharaj.
Bairstow was the first England batsman out for 99 in a Test match since Kevin Pietersen against Bangladesh in Chittagong in 2010.
Disclaimer: No Business Standard Journalist was involved in creation of this content