Opener Dilshan led from the front and was the only Sri Lankan to score over 50 as they were bowled out in the final over in Pallekele.
Dilshan's innings was ended in the 31st over when a delivery from JP Duminy got through his defences and hit the stumps.
The tail-end hardly dented the scoreboard as the hosts lost their last five wickets for 11 runs.
South Africa's top bowler was Ryan McLaren, who took four wickets for 48 runs from his 10 overs.
The Proteas won the first ODI in Colombo on Sunday by 75 runs.