Home side have set the Proteas a target of 395 runs
Rohit Sharma on Saturday struck a second hundred in his debut as Test opener to help India set South Africa a daunting 395 to win the opening match of their series.
The hosts declared their second innings on 323 for four in the final session of day four in Visakhapatnam.
South Africa were 11 for one at stumps with Aiden Markram, on three, and Theunis de Bruyn, on five, at the crease.
The visitors need another 384 runs and India nine wickets on the final day to get ahead in the three-match series.
"We picked up a crucial wicket, so as a team we are happy with the way things went today and hope to start off well (tomorrow)," Indian batsman Cheteshwar Pujara, who made 81 in India's second innings, told reporters. "It will not be easy to bat on this pitch on day five, with a little more assistance for the spinners. And with variable bounce, even the fast bowlers will come into play."
Ravindra Jadeja struck early after trapping first-innings centurion Dean Elgar for two in the fourth over of the innings.
The left-handed Elgar, who made 160 in the first innings, was given not out by the on-field umpire only for India to get the decision overturned with a TV review.
Markram and de Bruyn then played out the remaining overs from spinners Ravichandran Ashwin and Jadeja until bad light forced the extended play — to make up for lost time due to thunderstorm on day one — to be called off.
Sharma, who made 176 in India's first innings of 502 for seven declared, is the first batsman to hit two tons in his first match as a Test opener.
He also hit 13 sixes, the most in a Test match, breaking Wasim Akram's record of 12.
Sharma put on 169 with Pujara to frustrate South Africa after the loss of opener Mayank Agarwal for seven.
"The way Rohit was playing allowed me to settle down. Only he can play such shots on this track," said Pujara. "Our partnership between lunch and tea was crucial. Our communication was good as we have batted together a lot in Under-19 cricket. It was enjoyable to watch his batting from the non-striker's end."
Pujara was trapped lbw by Vernon Philander after he completed his 21st Test half-century.
Sharma survived a reprieve on 50 when he was caught at the boundary off Dane Piedt. Replays indicated that fielder Senuran Muthusamy's foot had touched the rope.
He was finally stumped off Keshav Maharaj as he attempted a big hit.
Jadeja hit a 32-ball 40 before being bowled by paceman Kagiso Rabada.
Maharaj struck before lunch, grabbing the key wicket of Agarwal, who hit 215 in the first innings, but the bowlers then struggled.
Earlier, Ashwin completed a haul of seven wickets as South Africa were bowled out for 431 in the morning session.
Ashwin got overnight batsman Maharaj out for nine and then trapped Rabada, leaving the Proteas 71 runs behind.
Philander said South Africa are confident of a good show come Sunday.
"We have had a really good first innings with the bat. The guys are in good spirits. It is going to be a challenge but one we look forward to," said the fast bowler. "There is no game that is a safe game. The batters are looking in good form and hopefully we can get a good start tomorrow."
Elgar was the hero of the South African innings with his 12th century that revived the tourists' batting after they had slipped to 63 for four.
His century partnerships with skipper Faf du Plessis, who made 55, and Quinton de Kock, who hit 111, were key to the Proteas fightback.