Dean Elgar and Quinton de Kock starred for South Africa to ensure the tourists remain in contention for the first Test against India at Visakhapatnam.
South Africa started the third day on 39 for three but Elgar (160) and De Kock (111) showed impressive resilience at the crease.
The duo put on a sixth-wicket stand of 164 runs to frustrate the India attack and haul their side back into the match following Thursday's top-order collapse.
Ravichandran Ashwin bowled De Kock to end the final session as the pick of the bowlers with five wickets.
South Africa will head into the penultimate day trailing India by 117 runs after the hosts declared on 502 for seven following Mayank Agarwal's double century.