South Africa need 331 runs to defeat Sri Lanka with nine wickets remaining after day four of the second Test ended with the hosts piling up a total of 229 runs in their second innings on a day that saw rain and bad lighting conditions.
Sri Lanka skipper Angelo Mathews remained unbeaten on 63 while the hosts lost eight wickets with two players not batting at all.
Faf du Plessis caught Kithuruwan Vithanage for his individual score of seven off Morne Morkel's delivery. Niroshan Dickwella got caught by A B de Villiers for his individual score of 16 off Dale Steyn's delivery.
Imran Tahir claimed Dilruwan Perera's wicket for his individual score of seven runs, while De Villiers caught Rangana Herath's for his individual score of four on Morkel's delivery.
Morkel claimed four wickets while Steyn and Tahir claimed two wickets each.
South Africa went in to bat after the hosts broke the innings at 229 runs. The visitors amassed 38 runs for the loss of one wicket and will open play on the final day of the Test with Dean Elgar and Quinton de Kock batting for the host side.
Elgar is batting at his individual score of 13 while De Kock is playing on 21 runs. South African opener Alviro Petersen went out for a duck as Kithuruwan Vithanage caught him on Herath's delivery.