The hosts began the final day on 138-2 in pursuit of 458 to win the first match of a two-Test series.
A 205-run fifth-wicket partnership between Faf du Plessis and AB de Villiers gave them hope of victory.
But De Villiers was bowled by Ishant Sharma for 103, before Du Plessis was run out for 134 with 19 balls left.
In between those dismissals, JP Duminy was out for five after he chopped on to his stumps from Mohammed Shami.
That left Dale Steyn to bat out the final three overs with Vernon Philander, with the world number one Test team still retaining hopes of a remarkable win against the side ranked second.
A maiden over each from Zaheer Khan and Shami effectively ended those hopes, although Steyn left the hosts wondering what might have been by smashing a six off the final ball of the match.
South Africa captain Graeme Smith defended the decision of his batsmen to play for the draw
He said: "The knocks that AB and Faf played, everybody would have been saying what an incredible effort.
"We mustn't lose sight of that in the emotion. You understand the emotional side. I think the context was that it was an unbelievable Test match. I don't think too many people gave us a chance [of drawing].''
India batsman Virat Kohli was surprised to see South Africa limit their ambitions to a draw.
He said: "Everyone was pretty shocked, honestly. We didn't think they'd stop going for that score."
The highest successful fourth-innings run chase in Test history remains the 418 scored by West Indies to beat Australia in 2003.
South Africa's total was the third-highest ever scored in a Test match fourth innings. New Zealand scored 451 at Christchurch in 2002 in losing to England, who hit 654-5 in a draw with South Africa at Durban in 1939.