Sri Lanka was already holding a decisive 3-1 lead in the series and came out all guns firing. The batsmen piled up 307 for 4 after Angelo Mathews, the captain, chose to bat on winning the toss, and the bowlers then shot South Africa out for 179 in 43.5 overs in the day-night match at the Premadasa stadium.
AB de Villiers played a captain's knock of 51, but could not prevent South Africa from sinking to its 13th defeat in 15 one-dayers on Sri Lankan soil.
South Africa was struggling at 137 for 8 when Ryan McLaren hit 29 and Aaron Phangiso scored an unbeaten 18 down the order to boost the total.
Suranga Lakmal, the seamer, and Sachithra Senanayake, the offspinner, marked their first appearance in the series by sharing five wickets, while Ajantha Mendis claimed 3 for 36.
Dilshan, who hit an unbeaten 115 in the fourth game in Pallekele on Sunday, plundered 13 boundaries before he was bowled for 99 by Ryan McLaren in the 39th over. Kumar Sangakkara then provided the fireworks at the end, and was unbeaten on 75 off just 45 balls as Sri Lanka plundered 52 runs in the last five overs.
Lahiru Thirimanne, promoted to No.3, also contributed his part, with a steady 68 (93 balls). Sangakkara hit 12 fours as the South African bowlers wilted in steamy conditions.
Thirimanne and Dilshan put on 163 for the second wicket after Kusal Perera was caught behind off Morne Morkel in the fifth over.
South Africa lost wickets in a heap to plunge to 85 for 6 by the 20th over, with Senanayake and Lakmal grabbing two wickets each. It was 60 for 1 in the tenth over when the dismissal of Hashim Amla for 18, lbw to Senanayake, triggered a middle-order collapse.
Lakmal removed Farhaan Behardien and David Miller in the space of three balls after Faf du Plessis had fallen to Thisara Perera for six.
De Villiers and the tailenders delayed the end, but Sri Lanka emerged the comfortable winner with an impressive all-round display.
In a match that held only academic interest, Sri Lanka rested Mahela Jayawardene, Lasith Malinga, Upul Tharanga and Rangana Herath. They were replaced by Lakmal, Senanayake, Angelo Perera and Kusal Perera.
South Africa recalled McLaren and Phangiso in place of Rory Kleinveldt and Robin Peterson.
The teams will now play three Twenty20 Internationals, with the first match to be held at the same venue on Friday.