Australia made hard work of grabbing a narrow lead over tenacious Sri Lanka on a second day tarnished by reckless run outs and rash shot-making in the third Test at the Sydney Cricket Ground.
The home side, with the series already clinched after wins in Hobart and Melbourne, edged on Friday to a 48-run lead over the tourists.
But it proved tough going and the Australians failed to get away to a bigger lead after a run-a-minute start.
At the close, Australia were 342 for six with Matthew Wade on 47 and Peter Siddle not out 16.
Wade lived dangerously late in the day, surviving two reviews and a dropped catch close in while on 22.
Australia self-destructed with two run outs while David Warner, Phil Hughes and Michael Clarke threw away their wickets with false strokes.
The top order carelessness was accentuated by Australia's decision to go into the third Test with four pace bowlers and promote wicketkeeper Wade to number six ahead of an elongated tail.
"Today we could look back and feel we could have been in a better position, it would have been nice to have a couple of wickets less," Hughes said.
"We're 40-odd runs ahead now. It would be nice to get 100 or so more ahead. We're well balanced in this game."
Warner and Hughes both missed out on centuries and Clarke, aghast at his part in the run out of the retiring Mike Hussey, was out attempting to slog sweep left-arm spinner Rangana Herath for 50.
Free-scoring Warner perished when he took on part-time spinner Tillakaratne Dilshan only to be well caught by Dhammika Prasad, back-pedalling at long-on, for 85 off 84 balls.
Hughes followed Warner back to the pavilion seven overs later, caught behind attempting to cut Herath for 87.
"A bit of mixed feelings in a way," Sri Lanka coach Graham Ford said of his team's position.
"It's been a much better performance than at Melbourne and a number of young players have come in and shown that they've got some guts and the desire to play at this level.
"On the other hand, perhaps it would have been better to get another 40 or 50 last night and then if one or two chances had stuck today we might have been in a better position."
Sri Lankan players gave Hussey a guard of honour to the crease amid acclaim from the SCG crowd in his 79th and final Test after announcing his retirement from international cricket.
The 37-year-old veteran lasted 51 balls before he was needlessly run out in possibly his final Test innings for 25 when he could not make his ground as Clarke took off for a quick single.
Karunaratne scored a direct hit with his throw at the striker's end and a diving Hussey failed to make his ground.
Clarke looked back in horror from the bowler's end as he sacrificed the wicket of his batting partner amid the emotion of his farewell Test.
Opener Ed Cowan ran himself out for four inside the opening half hour when he hesitated going for a second run and was beaten to the bowler's end by Nuwan Pradeep's throw.
It was the third time in Tests that Cowan has been involved in a run out and twice he himself has been run out.
Warner put on 130 runs for the second wicket with Hughes in just 122 minutes.
Hughes also looked on course for his fourth century in his 20th Test before he went for the cut shot once too often.
The diminutive left-hander, who faced 143 balls, played at Herath away from his body and edged to wicketkeeper Dinesh Chandimal.
Clarke, back at the SCG where he scored 329 not out against India a year ago, also looked in fine touch, lofting Herath for six and next ball went aerial again for four before his false stroke.
Mitchell Johnson, selected in an all-rounder role at number seven after his unbeaten 91 in Melbourne, was out caught behind off Pradeep for 13.
Pradeep halved his bowling average from 406 to 203 with his second Test wicket.