Vernon Philander took three wickets, while Morne Morkel and Kagiso Rabada claimed two each as India were subjected to a pace barrage in bowler-friendly conditions.
Earlier, it had been the Indian bowlers who held sway when South Africa were bowled out for 130 in their second innings, losing their last eight wickets for 65 runs.
India’s run chase started promisingly with Murali Vijay and Shikhar Dhawan putting on 30 for the first wicket, although Vijay was reprieved on review twice after being given out against Philander, for leg before wicket and a catch behind the wicket.
But then Dhawan was caught at gully off his bat handle when he got into a tangle against a lifting ball from Morkel. Six balls later it was third time lucky for Philander as Sharma edged a catch to AB de Villiers at third slip.
Philander claimed the key wicket of Indian captain Virat Kohli, who had looked confident in scoring 28 before he was trapped leg before wicket.
Philander struck again when Rohit Sharma was bowled off an inside edge and Rabada dismissed first innings top scorer Hardik Pandya for one, caught by a diving De Villiers at third slip.
Rabada trapped Wriddhiman Saha leg before with the last ball before tea to leave India in a desperate situation in a match hastening towards a conclusion despite the loss of the third day because of rain.
South Africa were without fast bowler Dale Steyn, ruled out of the rest of the series after suffering a heel injury while bowling on Saturday.
But Steyn, who arrived at the ground on crutches, limped to the wicket as the last batsman in an effort to keep company with AB de Villiers, who top-scored with 35. He managed to defend four balls from Bhuvneshwar Kumar but De Villiers was caught off Jasprit Bumrah in the next over by one of eight fielders stationed on the boundary.
Mohammed Shami and Bumrah were the main destroyers of the South African batting, taking three wickets each.
Shami started the collapse, dismissing Hashim Amla with the ninth ball of the morning and taking three wickets for 28 runs.
Bumrah took three for 39 and, in addition to De Villiers, claimed the key wickets of South African captain Faf du Plessis and Quinton de Kock, with Du Plessis falling to an unplayable delivery which lifted sharply off a good length and flicked a glove.
Wicketkeeper Saha set an Indian record by taking ten catches in the match, five in each innings.
After being under covers for two nights and a day, the pitch offered plenty of seam movement and occasional steep bounce.