As it happened: Sri Lanka v Proteas
Dilshan smashed 86 off 90 balls and also took three wickets for 40 runs to set the stage for a Sri Lankan victory in the day-night match at the Pallekele International Stadium.
Fast bowler Lasith Malinga chipped in with a valuable 4-24 as South Africa were bowled out for 180 off 38.1 overs while chasing Sri Lanka's 267 all out.
In-form opener Hashim Amla fought back brilliantly, making a 102-ball 101, but failed to find support from the other batsmen, only two of whom could manage scores in double figures.
Malinga gave Sri Lanka crucial breakthroughs when he sent back opener Quinton de Kock (four) and star batsman Jacques Kallis (one) in his consecutive overs.
Kallis, who was out for a second ball duck in the first game, fell to a sharp bouncer from the bowler, edging it straight to Kumar Sangakkara behind the stumps.
At the other end, Amla held the innings together, stringing a 75-run stand with skipper AB de Villiers (29) and reaching his 14th ODI century in the process.
But De Villers's dismissal in the 20th over by Dilshan triggered a collapse that derailed the South African innings and put the hosts in the driver's seat.
"Hashim (Amla) played an amazing innings but there were not enough partnerships around him. I got out to a soft dismissal as well," said de Villiers.
Earlier, Dilshan, 37, struck nine fours in his quickfire innings after Sri Lanka won the toss and chose to bat.The hosts looked in line for a bigger total but lost their last five wickets for 11 runs, with paceman Ryan McLaren (4-48) accounting for four of these dismissals.
"I was a bit concerned after we collapsed, I thought we were perhaps 30-40 runs short," said Sri Lankan skipper Angelo Mathews.
"But Dilshan played a great knock. All the spinners contributed as well."
The Proteas suffered an early setback when pace spearhead Dale Steyn had to leave the field after sustaining a bruise on his right thumb while attempting a return catch in his third over.
But with tests ruling out any fracture, Steyn came on to bat later, making 23.
Sri Lanka were off to a flying start with Dilshan going after the attack, but the visitors struck at regular intervals to peg back the scoring.
Opener Kusal Perera (seven) was the first to go, lobbing the ball tamely to Amla at short mid-wicket off fast bowler Vernon Philander (2-49).
Sangakkara, who scored a fine 89 in Sunday's match, was out for seven when he tried to pull a short delivery from Morne Morkel but ended up gloving it to the wicket-keeper.
Leg-spinner Imran Tahir (2-41) got rid of Lahiru Thirimanne (36) and then off-spinner Jean-Paul Duminy deceived Dilshan with a ball that deflected off the batsman's glove onto the stumps.
Jayawardene was given out lbw when he was on six, but the decision was overturned on review.
He went on to score a patient 48 off 70 balls and shared a 71-run stand with Mathews (34) to steady the innings.
Ashan Priyanjan provided some late impetus, hitting Morkel for a six and a boundary off consecutive deliveries in a cameo 25-run knock.
The third and final game will be played in Hambantota on Sunday.
South Africa: 180 all out in 38.1 overs (H. Amla 101; L. Malinga 4-24)
AB de Villiers (captain), Hashim Amla, Quinton de Kock (wicketkeeper), Jacques Kallis, JP Duminy, David Miller, Ryan McLaren, Vernon Philander, Dale Steyn, Morne Morkel, Imran Tahir
Angelo Mathews (captain), TM Dilshan, Kusal Perera, Kumar Sangakkara (wicketkeeper), Mahela Jayawardene, Lahiru Thirimanne, Ashan Priyanjana, Nuwan Kulasekara, Sachithra Senanayake, Ajantha Mendis, Lasith Malinga