Needing 197 runs to achieve a historic series win, Sri Lanka were 60 for two at the close of play on Day 2.
South Africa will aim for a desperate victory, to share the Test series and end a streak of seven successive home series wins.
Sri Lanka defeated South Africa by one wicket in the first Test.
Kusal Perera and Vishwa Fernando put on an unbeaten 78 in a last-wicket partnership to secure Sri Lanka's victory in Durban.
Dale Steyn took four for 48 as South Africa took a first innings lead of 44.
Chasing a target of 372, Sri Lanka were bundled out for 326 with six balls remaining.
Sri Lanka's top order batsman Kusal Perera hurt himself while attempting a catch at the long-on boundary during the third Test match against West Indies at Kensington Oval in Bridgetown.
Sri Lanka were 63 runs away from a first ever Test victory over the West Indies at the Kensington Oval on Monday following an action-packed third day of the final Test.
Highlights, India vs Sri Lanka, 4th T20I: India comprehensively beat Sri Lanka by 6 wickets on Monday
Mushfiqur Rahim scored a match-winning half-century as Bangladesh pulled off a memorable chase to stun Sri Lanka by five wickets in their Nidahas Trophy Twenty20 International match at R Premadasa Stadium in Colombo on Saturday.
Highlights, Sri Lanka vs Bangladesh, 3rd T20I: Bangladesh pulled off a memorable record chase to stun Sri Lanka by five wickets in the Nidahas Twenty20 Tri-Series here tonight, ending their recent run of reverses against the islanders owing to Mushfiqur Rahim's belligerent 35-ball 72.
Hosts Sri Lanka will aim to continue their recent domination against a beleaguered Bangladesh when the two teams meet in the Nidahas Twenty20 Trophy on Saturday.
Sri Lanka have managed to beat India after losing seven successive T20I games
India lost to Sri Lanka by 7 wickets to throw ICC Champions Trophy 2017 Group B wide open.
James Faulkner, who became the sixth Australian to take an ODI hat-trick, triggered a late collapse along with Mitchell Starc to restrict the hosts at 288
Kusal Perera was strongly supported by the Sri Lanka Cricket (SLC) after he was provisionally suspended by the International Cricket Council (ICC) in December 2015
Sri Lanka defeated Ireland by a massive margin of 136 runs to cleansweep the two-match One-Day International series 2-0.
Kusal Perera was cleared to play cricket last month, after the International Cricket Council found the laboratory result as faulty