Resuming at 299/5, South Africa were bowled out for 500 in reply to India's 334 and young guns Cheteshwar Pujara and Virat Kohli were holding the fort for the visitors on 32 and 11, respectively, when bad light stopped play with India at 68/2.
Earlier, South Africa took a 61-run first innings lead as they reached 395/7 at lunch, putting on 96 runs in 35.1 overs in the first session. However, they lost veteran Jacques Kallis (115) and Dale Steyn (44) during the period.
Playing in his last match, Kallis was given a guard of honour by the Indians when he came out to bat. The 38-year-old exuded experience to notch up his 45th century in possibly the last innings of his Test career.
The right-handed veteran was pure class as he put on an 86-run sixth-wicket partnership with Steyn and hit 13 boundaries. In the process, he also surpassed Rahul Dravid's total of 13,288 to emerge as the third-highest scorer in Test cricket at 13,289, behind Sachin Tendulkar (15,921) and Ricky Ponting (13,378).
However, while attempting a sweep off spinner Ravindra Jadeja, he top edged a delivery which was safely pounced by wicketkeeper Mahendra Singh Dhoni. Kingsmead rose to a standing ovation and Kallis saluted the crowd by raising his bat and soaking in the applause.
Three runs later, Steyn also departed after playing a stoic innings which included seven boundaries, edging a Zaheer Khan delivery to Dhoni.
Rain delayed the start after lunch but after play resumed, the hosts extended their lead to 163 runs with Faf du Plessis (43) and Robin Peterson (61) putting on a 110-run eighth-wicket partnership before the latter skied a Zaheer delivery to mid-off and was caught.
Du Plessis and Peterson scored their runs quickly, getting 102 runs in 14.1 overs. All-rounder du Plessis held the innings together while Peterson was the aggressor, notching up his third half-century in Tests. Peterson's 52-ball whirlwind innings constituted nine boundaries and a six while du Plessis hit four boundaries in his patient knock.
Meanwhile, the skies opened up once more and tea was called. Following that, South Africa were bowled out with the addition of another three runs as du Plessis was run out and Morne Morkel was caught and bowled by Jadeja who finished with career best figures of 6/138.
Trailing by 166 runs, India started poorly as Murali Vijay (6), who fell three short of a century in the first innings, was caught at first slip.
Shikhar Dhawan tried to hold the fort for a long time but was caught when du Plessis took a stunning one-handed catch at short mid-wicket to send him back to the pavilion.
Pujara and Kohli saw off the next eight overs. India have a tough Monday ahead of them as their batsman need to make sure they survive the fifth day pitch.
India 1st innings: 334 all out
South Africa 1st innings:
Graeme Smith c Dhawan b Jadeja 47
Alviro Petersen c Vijay b Jadeja 62
Hashim Amla b Shami 3
Jacques Kallis not out 78
A.B. de Villiers c Kohli b Jadeja 74
J.P. Duminy lbw b Jadeja 28
Dale Steyn not out 0
Faf du Plessis run out (R. Sharma) 43
Robin Peterson c Vijay b Khan 61
Vernon Philander not out 0
Morne Morkel c & b Jadeja 0
Extras (b 3, lb 15, w 2, nb 3) 23
Total (all out in 155.2 overs) 500
Fall of wickets: 1-103 (Smith, 27.1 overs), 2-113 (Amla, 32.6), 3-113 (Petersen, 33.1), 4-240 (de Villiers, 73.6), 5-298 (Duminy, 103.2), 6-384 (Kallis, 133.3), 7-387 (Steyn, 136.1), 8-497 (Peterson, 154.1), 9-500 (du Plessis, 154.6), 10-500 (Morkel, 155.2)
Zaheer Khan 28-4-97-2
Mohammed Shami 27-2-104-1
Ishant Sharma 31-7-114-0
Ravindra Jadeja 58.2-15-138-6
Rohit Sharma 11-1-29-0
India 2nd innings:
Shikhar Dhawan c du Plessis b Peterson 19
Murali Vijay c Smith b Philander 6
Cheteshwar Pujara not out 32
Virat Kohli not out 11
Total (for two wickets in 36 overs) 68
Fall of wickets: 1-8 (Vijay, 5.3 overs), 2-53 (Dhawan, 27.5)
Dale Steyn 7-5-5-0
Vernon Philander 6-2-9-1
Morne Morkel 6-2-11-0
Robin Peterson 9-2-23-1
J.P. Duminy 8-2-20-0