Steven Smith and Shaun Marsh hit centuries but Sri Lanka spinner Rangana Herath picked up six wickets to restrict Australia's first-innings lead to 24 runs on the third day of the third and final Test on Monday.
Captain Smith made 119 and opening batsman Marsh struck 130 as the touring side were all out for 379 in reply to Sri Lanka's total of 355.
The 38-year-old Herath continued tormenting Australia with left-arm spin, taking his series tally to 21 wickets.
The hosts, 2-0 up in the series, then lost night watchman Dilruwan Perera (eight) leg before to paceman Mitchell Starc as they reached 22 for one in their second innings at stumps.
Dimuth Karunaratne (eight), dropped on one by wicketkeeper Peter Nevill off Nathan Lyon, and Kaushal Silva (six) were the not out batsmen.
Resuming on 141-1, Smith and Marsh kept Sri Lanka wicketless through the morning session but both fell in the space of three overs after the new ball was taken after lunch.
The pair added 246 for the second wicket.
Marsh, playing his 18th Test after a seven-month absence, was the first to get to his hundred, his fourth in tests, with a paddle sweep off Dilruwan Perera that went to the boundary.
The 33-year-old, replacing opener Joe Burns in this match, was dropped on 64 and 121. He was finally out when he chopped seamer Suranga Lakmal on to his stumps.
Smith used his feet brilliantly against the spinners and brought up his 15th Test hundred with an on-driven single off Perera.
The right-hander was stumped smartly by wicketkeeper Kusal Perera off Herath who also dismissed all-rounder Moises Henriques (four) in similar fashion.
Mitchell Marsh (53) notched his second half-century in Tests before becoming another of Herath's victims. Off-spinner Perera also picked up two wickets.