Australia opener Phil Hughes scored his first Test hundred in 2-1/2 years on Monday as Sri Lanka pressed for a series levelling victory in the third and final Test.
The Australians, trailing by 157 runs on the first innings, finished the fourth day at 209 for three wickets for an overall lead of 52.
Hughes was undefeated on 122 with 16 fours and a six and captain Michael Clarke had scored eight.
Left-arm spinner Rangana Herath grabbed all three Australian wickets to fall to end the day with figures of three for 54.
Herath first trapped Shane Watson lbw for 21, a decision the batsman challenged and lost.
Shaun Marsh fell to a bat-pad catch at short leg for 18 although television replays showed the ball brushing past his pad to fielder Lahiru Thirimanne. Marsh did not challenge the decision but walked off.
Ricky Ponting became Herath's third victim when he failed to get on top of the ball and edged a catch to Mahela Jayawardene at slip for 28.
Earlier Angelo Mathews scored his maiden Test hundred to give Sri Lanka a handy first-innings lead of 157.
Mathews, 85 not out overnight, was stuck nervously in the nineties, losing three partners in quick succession but finally reached his century with a cover-driven four off Peter Siddle.
The 24-year old all-rounder, who had twice been dismissed in the nineties in his 16-Test career, jumped into the air to celebrate his century and was warmly applauded by his team mates in the dressing room.
Australia made early inroads into the Sri Lankan batting on Monday when Siddle breached the defence of debutant Saminda Eranga (12) and trapped Herath (3) leg before.
Chanaka Welegedara (1) was run out after a misunderstanding with Mathews with both batsmen stuck at the non-striker's end.
Siddle, who replaced the injured Ryan Harris for the final Test, was Australia's best bowler, finishing with four for 91.
Australia (1st innings): 316
Sri Lanka (1st innings): (overnight 428-6):
T Paranavitana c Ponting b Johnson 46
L Thirimanne b Siddle 28
K Sangakkara c Haddin b Siddle 79
M Jayawardene c Haddin b Watson 51
T Dilshan c Haddin b Copeland 83
A Mathews not out 105
P Jayawardene c Clarke b Copeland 47
S Eranga b Siddle 12
R Herath lbw b Siddle 3
C Welegedara run out 1
S Lakmal b Johnson 13
Extras: (B-1, LB-2, NB-2) 5
Total: (all out in 174 overs) 473
Fall of wickets: 1-56, 2-97, 3-198, 4-210, 5-331, 6-412, 7-436, 8-444, 9-450, 10-473 (Lakmal).
Bowling: Copeland 40-10-93-2, Siddle 35-8-91-4, Johnson 35-6-122-2, Watson 26-8-54-1, Lyon 34-5-91-0, Hussey 2-1-5-0, Ponting 2-0-14-0.
Australia (2nd innings): 209-3
S Watson lbw b Herath 21
P Hughes not out 122
S Marsh c Thirimanne b Herath 18
R Ponting c DPMD Jayawardene b Herath 28
M Clarke not out 8
Extras: (lb 7, w 5) 12
Total: (3 wickets; 68 overs) 209
Fall of wickets: 1-62, 2-122, 3-188
Bowling: Eranga 8 0 42 0, Lakmal 10 1 31 0, Welegedara 14 3 46 0, Herath 26 7 54 3, Dilshan 10 0 29 0.