Off-spinner Ravindra Jadeja was the wrecker-in-chief for India as he sent back four South Africans for 51 runs while Mohammed Shami scalped three wickets on a track that was said to be not suitable for the pacers.
Senuran Muthusamy (19 batting) and Dane Piedt (32 batting) showed resistance with the bat as the Proteas fought back in the first session of the final day.
Earlier, Rohit Sharma underlined his credentials as a Test opener with a second consecutive hundred as India set South Africa a target of 395 at stumps on Day 4 of the first Test on Saturday.
At close of play, the Proteas were 11/1 in their second innings with last innings's centurion Dean Elgar trapped in front by Ravindra Jadeja for just two and Aiden Markram (3 batting) at the crease with Theunis de Bruyn (5 batting).
Rohit built on his 176 in the first essay in spectacular fashion as he struck 127 from 149 balls, his innings studded with 10 fours and a whopping seven sixes to add to his six in the first dig, as he became the batsman to hit the most number of maximums in the longest format of the game.
Cheteshwar Pujara gave him good company with an aggressive 81 off 148 deliveries (13x4, 2x6) before Vernon Philander trapped him.
The pair added 169 for the first wicket as India declared on 323/4 with skipper Virat Kohli (31 not out) and his deputy Ajinkya Rahane (27 not out) batting.
Resuming the day at 385/8, South Africa were bowled out for 431 with ace off-spinner Ravichandran Ashwin picking up a seven-wicket haul.
It was a Rohit and Pujara show from there on as the pair paced their innings well keeping India's declaration in mind.
Mayank Agarwal, who scored his maiden double ton in the first innings, was dismissed for seven caught at first slip by South Africa skipper Faf du Plessis off left-arm spinner Keshav Maharaj.
Pujara brought up his first fifty after five innings in 106 deliveries with a delectable cover drive off Kagiso Rabada.
Rohit had luck going his way as he was caught by Senuran Muthusamy on 50 at long on but the debutant stepped on the boundary padding as he tried to lob it back in for himself to take on the second attempt, awarding a six instead.
Brief Scores: India 323/4 declared and 502/7 declared (Rohit Sharma 127, Cheteshwar Pujara 81, Keshav Maharaj 2/129); South Africa 431 (Dean Elgar 160, Quinton de Kock 111; R Ashwin 7/145) and amp; 1117/8 (Senuran Muthusamy 19 batting, Dane Piedt 32; batting Ravindra Jadeja 4/51)
( With inputs from IANS )