On Day Two of the Test, Sharma made 119 while Raina hit 135. On Day One, skipper Cheteshwar Pujara had scored 137 to help India gain control in the match.
Sharma and Raina had a 106-run partnership for the fourth wicket, which was broken when Sharma was caught by Temba Bavuma off JP Duminy.
India resumed the innings at 281 for three and declared after scoring 582 for nine as the Proteas were unable to break the last-wicket stand between Shahbaz Nadeem (46) and Jaydev Unadkat (31).
South Africa were 20 for the loss of one wicket in reply as Unadkat got opener Reeza Hendricks (10) caught behind. At stumps, Dean Elgar and Simon Harmer were at the crease.