Dilshan struck nine fours in his quickfire innings after Sri Lanka won the toss and chose to bat in the day-night match at the Pallekele International Stadium.
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.
South Africa, who won the opening game on Sunday by 75 runs, will need to score at 5.36 an over to win the game and seal the three-match series.
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.
Also Read
Opener Kusal Perera (seven) was the first to go, lobbing the ball tamely to Hashim Amla at short mid-wicket off fast bowler Vernon Philander (2-49).
Kumar 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.
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 skipper Angelo 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.