Faf du Plessis and Quinton de Kock hit half-centuries as South Africa stretched their lead on the third day of the first Test against Sri Lanka on Friday.
Du Plessis just missed out on a hundred after being dismissed for 90 when Vishwa Fernando trapped him lbw as the Proteas captain left a ball that swung back into him.
The South Africans were eventually bowled out for 259, setting Sri Lanka a target of 304 for victory at Kingsmead.
Earlier, De Kock made 55 before being lbw to debutant left-arm spinner Lasith Embuldeniya.
Resuming on 126/4, South African captain Du Plessis and wicket-keeper De Kock were largely untroubled on an easy-paced pitch, until De Kock went back to a ball from Embuldeniya, which spun into the left-hander and kept low.
De Kock was the more aggressive partner in a stand of 96 which eased South African nerves after the hosts had been struggling at 95/4.
De Kock made his runs off 62 balls with six fours.
Du Plessis had faced 139 deliveries by lunch, hitting 10 fours. Embuldeniya had figures of 3/51. (Courtesy AFP)