Steve Smith and David Warner resumed from where they left off on Day 3, adding 60 runs in the first hour on Day 4.
David Warner brought up his 19th Test century and only his second in Asia.
Shakib soon trapped Warner LBW, to trigger Australia's downfall.
Steve Smith couldn't be the visitors' saviour as he too became a victim of Shakib's bowling.
Taijul Islam too picked up key wickets in the middle as Australia began to slide towards a defeat.
Shakib Al Hasan dismissed Glenn Maxwell right after Lunch and became only the second player (after Richard Hadlee) to score a half-century and pick 10 wickets in a Test twice.
Pat Cummins lead a staunch resistance and threatened to shatter Bangladesh's dream of a historic victory.
Taijul Islam dismissed Hazlewood to end Australia's hope of a late victory.
Bangladesh recorded a historic first-ever win against Australia, beating the visitors by 20 runs.