Image courtesy of: ESPNcricinfo
South Africa captain Faf du Plessis struck a superb 90 before his side took three wickets after Sri Lanka were set 304 to win on the third day in Durban.
Starting off the day on 126/4, Du Plessis and Quinton de Kock converted their 31-run partnership into a 96-run stand before De Kock was trapped lbw off the bowling of debutant Lasith Embuldeniya for 55, which came off 62 balls and included six boundaries.
Du Plessis and Vernon Philander added 60 runs to the score before Philander was clean bowled by Embuldeniya for 18.
Du Plessis went on to score 90, which came off 182 deliveries and included 11 boundaries, before he was trapped lbw off the bowling of Vishwa Fernando.
Once Du Plessis was gone, South Africa completely collapsed as they went from 251/6 to being bowled out for 259, which set Sri Lanka 304 to win.
Embuldeniya was the pick of the bowlers with five wickets, while Fernando snapped up four and Kasun Rajitha chipped in with one.
Chasing 304 to win, Sri Lanka got off to a solid start as captain Dimuth Karunaratne and Lahiru Thirimane amassed a 42-run partnership before Thirimanne was dismissed by Kagiso Rabada for 21.
Karunaratne went on to score 20 before he was given out lbw off the bowling of Philander.
Kusal Mendis failed to trouble the scorers as he was caught behind off the bowling of Duanne Olivier for a duck.
Debutant Oshada Fernando and Kusal Perera ensured Sri Lanka didn’t lose anymore wickets as they forged an unbeaten 31-run stand before bad light brought play to an end for the day.
Fernando finished on 28, which came off 39 balls and included four boundaries, while Perera remained undefeated on 12, which came off 23 deliveries and included two boundaries.
Philander, Rabada and Olivier claimed one wicket each.
Sri Lanka ended day three on 83/3 and will continue batting on Saturday at 10:00 local time or 08:00 GMT.