LIVE scorecard: Sri Lanka v South Africa
Tillakaratne Dilshan shone for the host and narrowly missed out on his second successive century by one run as Sri Lanka piled up 307/4.
The aggressive opener, 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.
Lahiru Thirimanne, promoted to number three, scored 68 and Kumar Sangakkara was unbeaten on 75 off 45 balls after Sri Lanka won the toss and chose to bat at the Premadasa stadium.
Sangakkara hit 12 fours, helping the hosts take 52 runs from the final five overs 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.
Perera was one of the four changes made by the hosts, who have already taken an unassailable 3-1 lead in the series.
Sri Lanka rested Mahela Jayawardene, Lasith Malinga, Upul Tharanga and Rangana Herath, replacing them with seamer Suranga Lakmal, spinner Sachithra Senanayake and batsmen Angelo Perera and Kusal Perera.
The tourists, looking for a consolation win, recalled McLaren and spinner Aaron Phangiso in place of Rory Kleinveldt and Robin Peterson.
Teams:Sri Lanka
Kusal Perera, Tillakaratne Dilshan, Kumar Sangakkara (wicketkeeper), Lahiru Thirimanne, Dinesh Chandimal, Angelo Mathews (captain), Angelo Perera, Thisara Perera, Sachithra Senanayake, Suranga Lakmal, Ajantha Mendis
South Africa
Hashim Amla, Quinton de Kock (wicketkeeper), JP Duminy, AB de Villiers (captain), Faf du Plessis, David Miller, Farhaan Behardien, Ryan McLaren, Aaron Phangiso, Morne Morkel, Lonwabo Tsotsobe
Umpires: Richard Kettleborough (ENG) and Raveendra Wimalasiri (SRI)
TV umpire: Ranmore Martinesz (SRI)
Match referee: Andy Pycroft (ZIM)