Sri Lanka will now meet Australia [ Images ] in the triangular one-day series finals.
"It's nice to get a win under out belt," Sri Lanka coach Tom Moody said in a televised interview.
"Today was a lot better performance all round really."
Bandara destroyed the South African batting lineup, taking 4-31 from nine overs with his leg-spinners, as the Proteas collapsed to be all out for just 181 in reply to Sri Lanka's 257-9.
South Africa had needed to win just one of their last three matches to reach the finals but back-to-back losses against Australia meant everything was at stake in Tuesday's last preliminary match.
Atapattu slammed 80 off 122 balls then Sangakkara smashed 62 from 77 deliveries as the Sri Lankans raced to 175-1 in the 36th over when the South Africans suddenly hit back.
Paceman Johan van der Wath broke a 123-run stand between Atapattu and wicketkeeper Sangakkara when he had the latter caught by Boeta Dippenaar at mid off.
Van der Wath dismissed Atapattu in his next over, caught by Andrew Hall [ Images ], which triggered a mini-collapse.
Sri Lanka lost a steady stream of wickets to slump to 229-7 in the 47th over before Tillekeratne Dilshan [ Images ] chipped in with a rapid 30 to push the total past 250.
Hall was the pick of the South African bowlers, completing his 10 overs with figures of 3-50, while van der Wath and Charl Langeveldt grabbed to wickets each.
South African skipper Graeme Smith [ Images ] finally found form, completing his first haf-century of the tour, but after he fell for 67 the rest of the batting order collapsed.
Bandara, who came on for Atapattu, had Smith caught by Muttiah Muralitharan [ Images ] then trapped Justin Kemp in front for a golden duck.
The first final between Australia and Sri Lanka will take place in Adelaide on Friday with the second match scheduled for Sydney [ Images ] on Sunday. A third match, if required, will be held in Brisbane [ Images ] next Tuesday.