The hard-hitting left-hander struck a gritty 144 to help avoid the ignominy of a follow-on before the Australian bowlers struck crucial blows in Bangladesh's second innings Tuesday.
Bangladesh, who dismissed Australia for 269 in reply to their 427, were 124-5 in their second innings. Rajin Saleh (29) and Khaled Mashud (zero) were the not out batsmen.
After gaining a 158-run lead, the home side were 282 runs ahead with four wickets still remaining in their bid to set a big target and try for only their second win in 43 Tests.
Bangladesh failed to capitalise on the cushion of a big lead while Australia, who had a forgettable opening two days, looked determined to show why they are the world's top team.
Bangladesh, who have lost both their previous Tests to Australia by innings margins, squandered a fine start to their second innings.
Openers Shahriar Nafees (33) and Javed Omar (18) failed to get big knocks while captain Habibul Bashar (seven) was run out by a direct throw from Michael Clarke as he ran lethargically.
Bangladesh fell from 48 for no loss to 77-4 when Stuart Clark trapped Mohammad Ashraful (four) leg-before with a fullish delivery to pick his first wicket of the match.
Aftab Ahmed (17) became leg-spinner Stuart MacGill's victim to raise Australia's hopes towards the end of the day.
Australia, who came here after a 3-0 Test series triumph in South Africa, suffered a batting collapse on the second day but Gilchrist produced a fine knock under pressure.
Gilchrist, 51 overnight in a score of 145-6, batted with purpose to take his team past the target of 228 to avoid batting again.
The 34-year-old completed his 16th ton in 84 Tests with a drive through the covers off part-time spinner Saleh and continued to plunder runs in the company of tailenders.
He smashed 14 fours and six huge sixes, much to the home side's frustration.
Gilchrist added 73 valuable runs with Jason Gillespie (26) for the eighth wicket and 39 with Clark (zero) for the next, forcing the Bangladesh bowlers to end up bowling a restrictive line and length.
Gilchrist, who on Monday passed 5,000 runs in Tests, helped Australia to wriggle out of an embarrassing position as Bangladesh have never managed to give a follow-on to any team since gaining Test status in 2000.
For the home side, left-arm spinner Mohammad Rafique worked hard to bag his seventh five-wicket haul in 25 Tests, which included the prize scalp of Gilchrist.
Rafique finished with 5-62 as Gilchrist became the last man out for the Aussies when he holed out to Shahadat Hossain at deep mid-wicket.
The second and final Test will be held in Chittagong from Sunday. The Test series will be followed by a three-match One-day series.