The Proteas bowlers also played their part earlier as pacemen Lungi Ngidi and Andile Phehlukwayo claimed three wickets each to restrict Sri Lanka to 244-8 in 50 overs.
Skipper Angelo Mathews made 79 off 111 balls while Niroshan Dickwella scored 69 to give the Sri Lankan total some respectability after they elected to bat first.
“Excellent bowling performance, seemed like Sri Lanka would get 280-300 but we kept getting wickets,” an elated du Plessis said after the win.
“We kept pulling it back even with them having a set batsman. Plans were good and the execution was great,” he added.
South Africa began their innings with a big first-wicket partnership as de Kock hit bowlers to all parts of the ground during his 78-ball knock, laced with 13 fours and 1 six.
Dananjaya took two wickets after South Africa’s quick start but the rest of the bowling and some sloppy fielding let the home team down.
Dananjaya had Amla caught and bowled and then snapped up Aiden Markram for three. He later denied du Plessis his half-century with another caught and bowled effort.
De Kock, who made 47 in his team’s first win on Sunday, registered his 16th ODI fifty but missed out on a ton after becoming debutant paceman Kasun Rajitha’s first ODI victim.
Fast bowler Suranga Lakmal gave Sri Lanka hope of a turnaround after getting his 100th ODI wicket in David Miller, out for three, as South Africa wobbled at 198-5.
But Jean-Paul Duminy hit 32 and Willem Mulder kept calm with his unbeaten 19 to give their team a second straight win, after having been swept aside in the two-match Test series.
Earlier for Sri Lanka, Mathews and Dickwella showed grit in front of a persistent bowling attack that took regular wickets.
Ngidi struck twice in his very first over — the second of the innings — to reduce Sri Lanka to 13-2. He had Upul Tharanga caught behind for nine and then trapped Kusal Mendis lbw for nought.
Dickwella, Sri Lanka’s wicketkeeper-batsman, then got going with several valuable partnerships including a crucial 67-run fourth wicket stand with Mathews.
“We give away too many wickets upfront and were always playing catch up since then. Never got going at all with the bat,” said Mathews.
“Unfortunately, we didn’t hold onto the catches as well because you need to take those when you are defending such a score. The bowlers did fairly well but we didn’t field properly.
“Need to put it aside and move forward … There are some positives and we can still stay alive in the series if we win the next game.”
The third match is scheduled for Sunday in Kandy.