Overnight batsmen Usman Khawaja (26) and Steve Smith (30) didn't last long against Herath's spin, as Australia faltered after starting the day 66 for two in response to Sri Lanka's 117 all out inside 35 overs on Tuesday.
The veteran left-arm spinner had notched up 4-35 at lunch, after dismissing opener Joe Burns (3) on the first day.
Smith added just two runs to his overnight score, before being foxed by a cleverly disguised widish delivery from Herath, as wicketkeeper Dinesh Chandimal completed an easy stumping.
Debutant bowler Lakshan Sandakan made the crucial breakthrough by deceiving Marsh with a delivery that went the other way. Herath, returning for his second spell of the morning, claimed his fourth scalp when wicketkeeper Peter Nevill (2) was caught at mid-on by Kusal Perera.
Adam Voges (41 not out) battled hard to establish a respectable lead for the visitors, with Steve O'Keefe (3 not out) at the other end.