Rahane struck 100 not out with eight fours and three sixes but captain Virat Kohli missed out on a three-figure mark as he was out for 88.
Wriddhiman Saha was the other not out batsman, on 23.
Rahane, whose first innings knock of 127 had helped India gain a 213-run lead, carried on from his overnight score of 52 to pile on the agony for South Africa.
India is in a strong position to go 3-0 up in the series.