Faf du Plessis outgunned Upul Tharanga as South Africa continued their ODI dominance over Sri Lanka in Cape Town.
The Proteas held an unassailable 3-0 lead before Tuesday's game and Du Plessis' marvellous knock of 185 set the platform for a fourth straight win and a record 13th in a row on home soil.
Falling just three runs short of South Africa's record ODI individual score, Du Plessis laid the foundation as the Proteas racked up a Newlands-best 367-5 from their 50 overs.
Tharanga initially looked as though he was going to inspire a most wondrous of run-chases as he blasted a 73-ball hundred, but he eventually fell for 119 and an inexperienced Sri Lanka line-up could not carry on where the skipper left off as they lost by 40 runs.
After AB de Villiers won the toss and opted to bat, Du Plessis helped South Africa get over the early loss of Hashim Amla (1), combining for 100 runs with Quinton de Kock (55) and adding another 137 with De Villiers (64) for company.
A first South African double-hundred had looked on for parts and Du Plessis was well set as he entered the final over with Gary Kirsten's 1996 knock of 188 not out against the UAE.
However, the Test skipper could not clear the rope as he smashed Lahiru Madushanka (1-69) down the ground and Asela Gunaratne made the catch.
Sri Lanka had lost the previous three games heavily and Tharanga was clearly out to change that as he attacked South Africa from the off, taking the fourth over, bowled by JP Duminy, for 13 runs thanks to two sixes.
In all, Tharanga hit 11 fours and seven maximums in a thrilling knock that frayed some home nerves, but the counter-attack fell away after he steered Wayne Parnell (4-58) to point.
Sandun Weerakkody's debut half century gave the tourists brief hope of causing a sensational upset, the 23-year-old adding a much needed 58 in the final stages.
However, South Africa continued to take wickets to stunt their progress and ultimately Sri Lanka came up just short in a thrilling encounter - the tourists dismissed for 327 as Parnell removed last man Lakshan Sandakan (1).