Sri Lanka, 2-0 down in the series, closed on 239 for two with Atapattu unbeaten on 109. His knock from 199 balls included 17 boundaries. Mahela Jayawardene was unbeaten on 29.
Openers Atapattu and Sanath Jayasuriya made a brisk start to score 134 for the opening wicket, their first century stand for two-and-a-half years, before Jayasuriya skied a catch off part-time spinner Darren Lehmann to be dismissed for 71.
Atapattu added 41 with Kumar Sangakkara (22), before Lehmann broke through again courtesy of a dubious caught behind decision from umpire Steve Bucknor, and an unbeaten third-wicket partnership of 64 with Jayawardene.
Atapattu said: "It is always special to get a hundred against the best side in the world. I was not having a very good series and I am happy that it came right in this Test match."
He added: "There are no terrors in the wicket and there are still plenty of runs to be had, but it is starting to turn from good areas, not just from the rough, so we must make sure that we get a good total in the first innings."
Earlier, Australia, who started the day on 314 for six, added 87 in the morning session before Lehmann (153) became off-spinner Muttiah Muralitharan's fifth and final victim.
Left-arm seamer Chaminda Vaas, Sri Lanka's only fast bowler after Nuwan Zoysa injured his calf on the opening day, finished with three for 93 from 26 overs.
Lehmann's second century of the series, and the fifth of his 18-Test career, included 14 fours and two sixes.
Muralitharan took his series haul to 25 wickets and his career tally in Tests to 510 as he claimed five for 123.
Sri Lanka's openers launched a stunning assault against the new ball, bringing up 50 in just 45 balls before settling into a more sedate scoring pace after the introduction of leg spinner Shane Warne.
Jayasuriya was particularly brutal, smashing nine fours and one six in his 78-ball knock, while Atapattu returned to form after his lean start to the series with some classical strokes to reach his hundred.
The stand was a record for Sri Lanka against Australia for the first wicket, surpassing the 110 compiled by Roshan Mahanama and Chandika Haturusingha at the same venue in 1992/93.
Scoreboard
Australia first innings (overnight 314-6)
J.Langer c Dilshan b Vaas 19
M.Hayden c sub b Samaraweera 25
R.Ponting c Muralitharan b Vaas 92
D.Martyn c Sangakkara b Vaas 14
D.Lehmann c Jayasuriya b Muralitharan 153
S.Katich c and b Muralitharan 14
A.Gilchrist c Jayasuriya b Muralitharan 22
S.Warne lbw b Muralitharan 32
J.Gillespie c Tillakaratne b Muralitharan 0
M.Kasprowicz b Jayasuriya 4
B.Williams not out 0
Extras (b-13 lb-9 nb-4) 26
Total (all out, 115.1 overs) 401
Fall of wickets: 1-43 2-60 3-96 4-217 5-244 6-299 7-376 8-380 9-387
Bowling: Vaas 26-3-93-3 (1-nb), Zoysa 3.3-1-23-0, Samaraweera 14.3-1-37-1 (2-nb), Muralitharan 37.1-6-123-5,
Herath 23-4-76-0 (1-nb), Jayasuriya 11-1-27-1
Sri Lanka first innings
M.Atapattu not out 109
S.Jayasuriya c Gillespie b Lehmann 71
K.Sangakkara c Gilchrist b Lehmann 22
M.Jayawardene not out 29
Extras (b-4 lb-2 nb-2) 8
Total (for two wickets, 64 overs) 239
To bat: H.Tillakaratne, T.Samaraweera, T.Dilshan, C.Vaas, N.Zoysa, R.Herath, M.Muralitharan.
Fall of wickets: 1-134 2-175
Bowling: Gillespie 9-0-57-0, Kasprowicz 10-1-29-0 (1-nb), Williams 8-2-27-0 (1-nb), Warne 18-4-58-0,
Lehmann 11-1-33-2, Katich 8-0-29-0