Sri Lanka, who trail the five-match series 2-1, suffered from a lack of partnerships as their innings ran out of steam. They folded on the last ball of the 50th over after electing to bat first.
Australia's pace spearhead Mitchell Starc struck in the very first over to have debutant batsman Avishka Fernando trapped lbw for nought.
Hastings, who recorded career-best figures of 6-45, soon got Kusal Mendis caught behind for one. The on-field umpire gave the batsman not out before Australia successfully reviewed the decision.
De Silva, who scored 76, and Mathews then started a rebuilding act, mixing caution and aggression against a persistent attack.
Also Read
Mathews, who was badly shaken after being hit on the back of his helmet off a Boland bouncer, made a gritty 28 before retiring hurt with a calf injury that hampered his footwork and running between the wickets.
De Silva, whose maiden ODI half-century included nine boundaries, looked a little edgy after Mathews' departure and soon departed after spooning a catch to mid-wicket off Hastings.
Left-handed all-rounder Sachith Pathirana scored a crucial 24-run cameo to help Sri Lanka pass the 200-run mark from a precarious 165 for seven.
Hastings' double strike in the 48th over brought him his maiden five-wicket haul in ODIs.
A limping Mathews, who scored a gutsy 40, returned to bat in the 48th over to add some useful runs as the hosts struggled to draw level in the series.
Disclaimer: No Business Standard Journalist was involved in creation of this content