Opting to bat first, Sri Lanka were all out for 226 with four balls remaining, a total built around Dinesh Chandimal’s gutsy 102 in an otherwise poor batting display by the hosts in the third match of the series.
Dilshan’s fluent 42 in his one-day swansong was the second highest score and the former Sri Lanka captain quit the format with 10,290 runs, including 22 centuries from 330 matches.
He will play the two Twenty20 matches against Australia next month before retiring from international cricket.
Australia wobbled early in their reply but George Bailey (70) featured in two fifty-plus partnerships as the tourists chased down the target with four overs to spare.
Earlier, Dilshan was given a guard of honour by his team mates when the 39-year-old went out to bat but the team looked in trouble after being reduced to 23 for two in the fourth over.
Dilshan joined forces with Chandimal to steady the ship with a 73-run partnership before he fell to an Adam Zampa full toss.
Australian fielders shook hands with Dilshan, who received a standing ovation from the sellout crowd at the Rangiri Dambulla International Stadium.
Zampa dismissed Angelo Mathews in his next over but Chandimal maintained his red hot 50-overs form and brought up his fourth one-day century before being the last man out, holing out to Zampa off James Faulkner.
Chandimal’s last seven one-day scores are 52, 62, 63, 53, 80 not out, 48 and 102.
Leading the side in absence of regular skipper Steve Smith, who has returned home to rest, David Warner marshalled his bowlers well to restrict the hosts to a modest total.
Mathews dented Australia’s top order, however, cheaply dismissing Warner and Shaun Marsh as the touring side slumped to 44 for three in the ninth over.
Bailey added 62 runs with Travis Head (36) to put Australia’s chase back on track and put on 81 runs with Matthew Wade (42) to take the side close to victory.
Zampa, who had claimed 3-38 with the ball, scored the winning run but Bailey bagged the man-of-the-match award.
The teams stay put in Dambulla for the fourth one-dayer on Wednesday.