But the visitors lost five wickets in the final hour before lunch, and any remaining hope evaporated when Glenn Maxwell was bowled by left-arm spinner Shakib with the first ball of the second session.
Tailender Pat Cummins fought valiantly, belting offspinner Mehedi Hasan for two sixes in one over on the way to an unbeaten 33, but it was all over when Taijul Islam trapped Josh Hazlewood lbw for a duck.
Australia will be rightly embarrassed to have lost to a side ranked No.9 in the world who had only won nine of 100 Tests.
The first Test between the two sides in more than a decade had loomed as an opportunity for Australia to overcome their dreadful record on the subcontinent and notch their first series win in Asia since beating Sri Lanka 1-0 in 2011.
But for all their dominance at home, Australia showed they remain a fragile side overseas who could be easily exposed by quality spinners.
The day-four pitch ended up being relatively benign but the visitors still had no answers for the masterful Shakib, who time and again beat Australia's batsmen with turn and flight.
Shakib proved why he was the world's No.1-ranked allrounder across all three formats, taking five-wicket hauls in both digs after top-scoring with 84 in the first innings.
The match unravelled for Australia in a disastrous hour before lunch when they lost five wickets after reaching a competitive 3-166.
After resuming on 75, Warner raced to triple figures before being trapped lbw by Shakib on 112.
Warner instantly reviewed Aleem Dar's decision but replays confirmed it was hitting middle and leg.
Steve Smith, who survived a tight stumping decision from his first ball on day three and had twice been dropped, finally ran out of lives a short time later.
The skipper was dismissed on 37 after attempting a cut shot which caught the edge and was taken by wicketkeeper Mushfiqur Rahim.
Peter Handscomb (15) soon followed in similar fashion, poking at a Taijul delivery which was caught brilliantly by Soumya Sarkar at first slip.
Matthew Wade narrowly avoided playing onto his stumps off his third ball faced and was soon out lbw to Shakib on four.
The wicketkeeper called for a review but it was a dreadful call, with replays showing he was plumb.
Cummins and Nathan Lyon fought bravely after lunch to put on a 29-run partnership before Lyon gloved a Mehedi delivery to Soumya at first slip.
- AAP