Dinesh Chandimal continued to mix caution with aggression even as he kept running out of partners at the other end.
John Hastings and James Faulkner got among the wickets as Sri Lanka looked headed for a sub-200 total.
Adam Zampa picked up three wickets as Sri Lanka's middle-order capitulated in the the face of some disciplined Australian bowling.
Tillakaratne Dilshan and Dinesh Chandimal steadied Sri Lanka's innings before the former was dismissed by Adam Zampa for 42 in his final ODI innings.
Tillakaratne Dilshan left the field after his final innings in the one-day format to a rousing ovation.
Mitchell Starc and Josh Hazelwood struck early after Sri Lanka won the toss and elected to bat.
Despite a lower-order wobble, George Bailey's 99-ball 70 ensured Australia scraped home to a two-wicket victory.
Dilruwan Perera dismissed a well-set Travis Head but with George Bailey batting confidently at the other end, Australia clawed away large chunks of the target.
Angelo Mathews's double strike gave the hosts a glimmer of hope.
Denesh Chandimal held one end firm to score his fourth ODI century, thereby propelling Sri Lanka to 226.
Tillakaratne Dilshan (C) received a guard of honour from his teammates in what was his final ODI.
Aaron Finch got Australia's chase of a sub-par total to a bright start.