De Kock hit 121 in a South African total of 331 for five, highlighting what captain Faf du Plessis described as a “brilliant” team batting effort.
Sri Lanka, chasing a revised target of 193 in 24 overs after a lengthy rain delay, made 121 for five.
South Africa’s 71-run win, according to the Duckworth/Lewis/Stern formula, gave them a winning 3-0 lead in the five-match series.
Sri Lanka were 75 for two after 16 overs at the rain break and faced a near-impossible task of scoring another 118 off 48 balls when play resumed, especially with Kusal Perera out of action with a leg injury.
Perera, star of Sri Lanka’s upset win in the first Test at the same venue last month, left the field in the seventh over of the match after hurting his left leg while fielding.
“Rain-affected games are not nice but the way we bowled up front, getting wickets, it was going to be tough for them in a full game,” said Du Plessis.
Sri Lanka captain Lasith Malinga said poor bowling and fielding had enabled South Africa to score 40 or 50 more runs than they should have.
“We had a good start (with the bat) but after the rain it was very hard.”
The left-handed De Kock had made scores between 80 and 94 in his five previous matches for South Africa, including two Test matches.
Sri Lanka gave a first one-day international cap to their ambidextrous former Under-19 captain, Kamindu Mendis.
Bowling slow left-arm around the wicket to right-handers and right-arm around the wicket to left-handed batsmen, he was Sri Lanka’s most economical bowler. Mendis, 20, maintained impressive control and took one for 45 in an unbroken ten-over spell. - AFP