Hashim Amla made 311 not out as South Africa made 637 for two declared; a first innings lead of 252.
England were 102 for four at the close, needing another 150 runs to avoid an innings defeat.
"I am happy, surprised and really excited that I managed to do something that has never been done before by a South African, but the biggest pleasure is that the team is in a dominant position to win this Test match," said Amla.
He said a triple century had not been on his mind until he reached 250.
"I didn't dream about getting 300," he said. "I've always been a person who never sets goals. In many ways that helps you because you can keep going without being limited.
Amla and Jacques Kallis (182 not out) batted with relentless concentration and skill as they put on an unbeaten 377 for the third wicket, a record for any wicket in matches between England and South Africa.
Amla paid tribute to his two partners in stands that sapped the energy from the England bowlers.
He put on 259 for the second wicket with captain Graeme Smith before he and Kallis took the game beyond England's reach.
"It was tough going early doors," he said. "They bowled really well. Graeme and I hung in there and he batted superbly. His knock was a major stepping stone for us.
"Jacques was extremely supportive at the other end. He's such an experienced campaigner and he gave a lot of support and guidance."