Theunis de Bruyn scored a defiant maiden Test century but Rangana Herath spun Sri Lanka to a 199-run victory in Colombo to whitewash South Africa on day four.
Sri Lanka needed just five wickets to complete a convincing 2-0 series win on Monday, but De Bruyn and Temba Bavuma showed some much-needed resistance to keep the hosts waiting.
De Bruyn (101) played with patience in a superb 232-ball innings, putting on 123 for the sixth wicket with Bavuma (63) under pressure from the potent Sri Lanka spinners.
Herath came to the fore yet again, though, striking twice just before lunch and finishing with figures of 6-98 - his 34rd five-wicket Test haul - to eventually dismiss the tourists for 290.
Suranga Lakmal, who bowled only two overs in the match, has now won all three Tests since stepping in to replace suspended captain Dinesh Chandimal.
It's a wrap! Sri Lanka beat South Africa by massive 199 runs and seal the 2-match series 2-0!
SA 124 & 290 (86.5 Ovs, Herath 6/98) v SL 338, 275/5dhttps://t.co/ne7t5sHYOe #SLvSA #LionsRoar #OneTeamOneNation pic.twitter.com/pwwiiIBiKk
— Sri Lanka Cricket (@OfficialSLC) July 23, 2018
De Bruyn, promoted to number three in his sixth Test, was solid in defence and took every opportunity to attack after South Africa resumed on 139-5, reaching his 50 by punching Dilruwan Perera to the cover boundary.
Bavuma took a more positive approach, sweeping with assurance and striking Akila Dananjaya to the ropes twice in an expensive over.
The diminutive right-hander made it through to his half-century when he swept Herath for a single, but the slow bowler had him caught behind to end a long partnership, then removed Quinton de Kock just before the interval.
De Bruyn continued to tick along with support from Kagiso Rabada, who danced down the track to launch Herath for a huge straight six.
The excellent De Bruyn reached three figures by glancing Herath to the fine-leg boundary but was on his way four balls later, bowled offering no shot to gift the left-armer a fifth wicket in the innings.
Dilruwan (2-90) saw the back of Rabada for 18 and Danushka Gunathilaka took a high catch to consign South Africa to defeat as Dale Steyn failed in his attempt to hit Herath for a second six.