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 on Sunday.
South Africa set England 474 to win after declaring their second innings on 343 for nine late on the third day.
The most made by any side to win in the fourth innings of a Test is the West Indies' 418 for seven against Australia at St John's, Antigua, in 2002/03.
England's corresponding record is 332 for seven against Australia at Melbourne back in 1928/29.
On Sunday, England were left with a tricky four overs' batting 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 former Australia paceman's verdict was overturned.
Cook and fellow left-hander Keaton Jennings survived to both be nought not out at the close, with England one for none courtesy of a leg bye.
Earlier Amla, so often a thorn in England's side, made 87 -- his second fifty of the match.
Opener Dean Elgar (80) and returning captain Faf du Plessis (63) were also among the runs as the Proteas, 1-0 behind in the four-match series after a 211-run defeat in the first Test at Lord's last week, cemented their already strong position in this match.
- 'Character' -
"I have a big smile on my face but there is a long road to go," Elgar told Sky Sports.
"Our message after Lord's was that we hadn't become bad players overnight and that we should clear our minds and put those bad thoughts to bed," added Elgar, the stand-in skipper at the 'home of cricket' after du Plessis was absent following the birth of his first child.
"We have a lot of character and we wanted to show it."
Meanwhile England bowling coach Ottis Gibson said: "It is a great game to win from here. You have to give a lot of credit to South Africa."
The Proteas resumed on 75 for one.
Elgar was 38 not out and Amla 23 not out, with England desperately needing early wickets after yet another batting collapse left them 130 runs adrift on first innings.
Stuart Broad, on his Nottinghamshire home ground, produced an excellent delivery to Amla, on 25, which carried to wicket-keeper Jonny Bairstow.
England appealed half-heartedly and decided against reviewing Australian umpire Simon Fry's not out decision, only for replays to show a nick.
Elgar had a reprieve on 55 when a thick edge off Broad flew high to gully where a diving James Anderson so nearly held a spectacular catch.
But Elgar, who had demonstrated a resilience and ability to soak up pressure so far lacking among England's top three in this match, eventually fell when he 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 long in command, their batsmen had no need to take undue risks.
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 left-arm spinner 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 -- who made South Africa's Test record 311 not out against England at The Oval in 2012 -- was out.
It was the end of a near five-hour innings of 180 balls including 14 fours and that lone six.
Du Plessis saw his patient vigil of 128 balls, including nine fours, end when he was lbw to Stokes with the new ball.
But Vernon Philander, with grey clouds having given way to blue skies, slog-swept sixes off two successive deliveries from Moeen Ali before the off-spinner caught and bowled him for 42 to prompt du Plessis's declaration.