Dom Sibley scored a maiden century to put England on top but South Africa have launched a rear-guard to keep the tourists' victory charge at bay after going to the close of the fourth day of the second test on 126 for two.
South Africa have been set 438 for victory at Newlands and will have to score a further 312 runs in 90 overs on the final day to achieve the highest run chase in test cricket history.
It is much more likely, however, they will have to bat out the final three sessions to save the test.
Debutant opener Pieter Malan is unbeaten on 63 and is at the crease with nightwatchman Keshav Maharaj (2 not out) on a wicket that has flattened considerably for the seamers, but is offering turn to the slow bowlers.
Dean Elgar (34) and Zubayr Hamza (18) are the two players out, the latter in the penultimate over of the day when he edged James Anderson to wicketkeeper Jos Buttler.
South Africa famously scored 438 to beat Australia in a one-day international at the Wanderers in 2006 in which current coach Mark Boucher hit the winning runs.
But this would represent an even bigger achievement for a side that has lost many of its batting greats to retirement in recent years.
The current highest success run chase in tests was 418 by West Indies against Australia in 2003.
England set the stiff target after declaring their second innings on 391 for eight just after lunch, with opener Sibley unbeaten on a patient 133 to go with an explosive 72 from Ben Stokes.
Sibley's hundred was met by an almighty roar from the sizeable travelling English support, even if it took him 269 balls to get there.
Stokes was providing plenty of entertainment at the other end as he took on the task of providing the quick runs England wanted to build a big enough lead and still have enough time to bowl South Africa out a second time.
He smashed seven fours and three sixes in a 47-ball innings of 72, before being caught at mid-on by Rassie van der Dussen off spinner Keshav Maharaj.
His blitz propelled England to 157 runs in 27 overs in the morning session and crucially sped up the game in their pursuit of victory.
South Africa won the first test of the four-match series by 107 runs in Pretoria.