Sri Lanka kept their hopes alive of securing a series-levelling win over Australia in the final Test in Colombo on Monday, despite an unbeaten century from opener Phil Hughes.
Left-arm spinner Rangana Herath grabbed all three wickets as the tourists, trailing by 157 runs on the first innings, ended the fourth day's play at 209-3 in their second knock at the Sinhalese Sports Club.
Hughes was unbeaten on 122 and skipper Michael Clarke was on eight, with Australia going into the final day on Tuesday 52 runs ahead with seven wickets in hand.
Clarke's men will need to bat out at least two of the last three sessions to draw the match and clinch the series 1-0 on the back of a 125-run win in the first Test in Galle.
The rain-hit second match in Pallekele was drawn.
Hughes had walked to the crease in danger of losing his spot in the team after failing to score a half-century in 11 innings since an unbeaten 86 against New Zealand in March last year.
The left-hander, who had an umpire's review for a catch at the wicket go in his favour off the last ball of the day, responded with an aggressive knock that contained 16 boundaries and a six.
Hughes had also survived a review for leg-before on 99 before cutting seamer Chanaka Welegedara for two runs later in the same over to bring up his third Test century.
Hughes celebrated the landmark by raising his fist towards the travelling Australian media in the press box before he acknowledged the cheers from his team-mates and the crowd.
Hughes contributed 36 in an opening stand of 62 with Shane Watson, who fell leg-before to Herath for 21 when a TV review overturned umpire Tony Hill's decision to reprieve the batsman.
Shaun Marsh added 60 for the second wicket with Hughes when he was given out by Hill, caught at short-leg off Herath, even though replays showed the ball made no contact with the bat.
Marsh, surprisingly, did not ask for a review.
Marsh then put on 66 for the third wicket with Ricky Ponting, before the former captain edged a vicious turner from Herath to the slips after making 28.
Earlier, Sri Lanka gained a sizeable lead through a maiden Test century from vice-captain Angelo Mathews.
Mathews returned unbeaten on 105 as the hosts added 45 runs to their overnight score of 428-6 before they were all out for 473 shortly before lunch on the fourth day.
Fast bowler Peter Siddle claimed two of the last four Sri Lankan wickets to finish with 4-91 from 35 overs. Trent Copeland and Mitchell Johnson picked up two wickets each.
Siddle bowled Shaminda Eranga for 12 and trapped Herath leg-before for three within the first hour.
Mathews was stranded on 95 when Sri Lanka lost their ninth wicket, but the right-hander reached the coveted century by driving Siddle to the cover fence for his 10th boundary.
The 24-year-old has been one of Sri Lanka's few batting stars in the series, having made 95 in the first Test and 58 in the drawn second game.
Last man Suranga Lakmal contributed 13 in a 10th-wicket stand of 23 with Mathews before he was bowled by Johnson.