The hosts, already holding a decisive 3-1 lead, piled up 307-4 after electing to take first strike and then shot the Proteas out for 179 in 43.5 overs in the day-night match at the Premadasa stadium. (Agencies)
AB de Villiers played a captain's knock of 51, but could not prevent South Africa from being condemned to their 13th defeat in 15 one-dayers on Sri Lankan soil.
The tourists were struggling at 137-8 when Ryan McLaren hit 29 and Aaron Phangiso an unbeaten 18 down the order to boost the total.
Seamer Suranga Lakmal and off-spinner Sachithra Senanayake marked their first appearance in the series by sharing five wickets. Ajantha Mendis claimed three for 36.
Opener Dilshan, who hit an unbeaten 115 in the fourth game in Pallekele on Sunday, plundered 13 boundaries before he was bowled for 99 by McLaren in the 39th over.
"I am a bit disappointed at missing my century, but these things happen in cricket," said Dilshan.
"I am really enjoying my cricket these days. When I get a start, I want to make it count. This has been a good series for me. I have batted, bowled and fielded well," he added.
Lahiru Thirimanne, promoted to number three, scored 68 and Kumar Sangakkara was unbeaten on 75 off 45 balls as the South African bowlers wilted in steamy conditions.
Left-handed 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-6 by the 20th over, with Senanayake and Lakmal grabbing two wickets each.
The Proteas were 60-1 in the 10th over when the dismissal of star batsman Hashim Amla for 18, leg-before to Senanayake, triggered a middle-order collapse.
The hosts, already holding a decisive 3-1 lead, piled up 307-4 after electing to take first strike and then shot the Proteas out for 179 in 43.5 overs in the day-night match at the Premadasa stadium.