Australia's No 3 had gone 10 Test innings without a hundred, dating back to October.
Australia will leapfrog England in the latest rankings if they beat Sri Lanka 2-0.
Khawaja's 101* saw Australia declare with a lead of 515 at Canberra's Manuka Oval.
Khawaja reached three figures for the first time since October 2018.
But it was far from plain sailing for Australia, who were 67/3 at the tea break.
Mitchell Starc ended with 5/54 as Australia grabbed a lead of 319 at Manuka Oval.
At lunch on day three, Sri Lanka were 215/7 in reply to Australia's 534.
The Sri Lankan opener was stretchered off from the field and then was taken to a hospital.
Head scored a Test-best 161 to help Australia end day one on 384/4 at Manuka Oval.
Not since October 11, 2018 had an Australia batsman crossed 84 until day one at Manuka Oval.