Hashim Amla helped South Africa pile on the runs to leave England facing what would be a record-breaking chase in the second Test at Trent Bridge.
South Africa set England 474 to win after declaring its second innings on 343 for 9 late on the third day.
The most made by any side to win in the fourth innings of a Test is Windies' 418 for 7 against Australia at St John's, Antigua, in 2002-03.
England was left with a tricky four overs to bat before stumps. South Africa nearly had a wicket with the very first ball when Alastair Cook was given out lbw to Morne Morkel. But Cook immediately reviewed umpire Paul Reiffel's decision and, with replays indicating the ball would have gone over the stumps, the verdict was overturned.
Cook and Keaton Jennings both survived to be nought not out at the close, with England one for none courtesy of a lone leg-bye.
Earlier Amla, so often a thorn in England's side, made 87 - his second fifty of the match.
Dean Elgar (80) and Faf du Plessis (63) were also among the runs as the visiting side, 1-0 behind in this four-match series with a 211-run defeat in the first Test at Lord's last week, cemented its already strong position in this match.
South Africa resumed the day on 75 for 1 with Elgar 38 not out and Amla 23 not out. England was in desperate need of early wickets after some bad batting on Saturday saw it concede a first-innings lead of 130.
It should have had one when Stuart Broad produced an excellent delivery to Amla, on 25, which carried to Jonny Bairstow, the wicketkeeper. England appealed half-heartedly and then decided against reviewing umpire Simon Fry's not out decision, only for replays to indicate there had been an edge.
Elgar had a reprieve on 55 when a thick edge off Broad flew high to gully where James Anderson, diving to his left, so nearly held a spectacular catch.
England eventually had a breakthrough when the painstaking Elgar took his eye off a Ben Stokes bouncer and tamely mis-hooked to Anderson at backward square-leg.
England bowled tightly either side of lunch but with South Africa in command and so much time left in the game, its batsmen had no need to take undue risks. Amla and du Plessis were largely content to pick off the loose ball.
But closing in on what would have been his 27th Test century and seventh against England, Amla - who made 78 in the first innings - fell 13 short this time around.
Trying to whip Liam Dawson, whom he'd earlier hit for a straight six to complete his fifty, Amla was struck on the pad. Reiffel rejected the lbw appeal but England's review was successful and Amla was out. It was the end of a near five-hour innings of 180 balls including 14 fours and that lone six.
Du Plessis, who did not play at Lord's following the birth of his first child, saw his patient vigil of 128 balls, including nine fours, end when he was lbw to Stokes with the new ball.
But with early cloud cover having given way to sunny blue skies, Philander kept the runs coming with two slog-sweep sixes off successive deliveries from Moeen Ali during his entertaining 42. The off-spinner, who took 4 for 78, eventually caught and bowled Philander to prompt du Plessis's declaration.