Bangladesh had Australia reeling at 18-3 after scoring 260 in its first innings on the first day to take control of the opening test on Sunday.
With nine overs to survive before the close of play, Australian batsmen were unable to deal with the Bangladesh spinners on a pitch that offered a considerable amount of turn and bounce.
Opener Matt Renshaw was not out on 6 with captain Steven Smith on 3 to end the see-saw day in which 13 wickets fell.
Opener David Warner survived a video review as the ball touched his bat before hitting the pad but was dismissed on the next ball off off-spinner Mehidy Hasan on 8.
Usman Khawaja was run out on 1 while nightwatchman Nathan Lyon got dismissed before opening his account, prompting Smith to see off the day.
Hasan and Shakib picked up a wicket apiece.
Earlier, Shakib Al Hasan scored 84 and Tamim Iqbal 71 in their 50th test as Bangladesh recovered from paceman Pat Cummins onslaught to amass 260.
Cummins (3-63) ripped through the Bangladesh top order in his first two overs to reduce Bangladesh to 10-3.
Shakib and Tamim combined for 155 runs in a fourth wicket stand before Glenn Maxwell broke through to dismiss the latter.
Offspinner Nathan Lyon then equalled the wicket tally of Richie Benaud (248), removing Shakib with a delivery that had extra bounce and spun sharply. He then removed Mehidy Hasan to get past Benaud to sit behind only Shane Warne (708) among Australia's all-time best spinners.
Shakib's 22nd half century included 11 boundaries.
Despite his careful approach, Tamim offered a chance on 62 when fast bowler Josh Hazlewood couldn't quite hold on to what would have been a brilliant catch off his own bowling.
The Bangladesh opener smashed five boundaries and three sixes in his innings, lasting for 144 balls before he was induced by the part-time offspinner Maxwell who extracted maximum turn from his delivery.
With the pitch getting slower, Ashton Agar and Lyon cleaned up Bangladesh tail after a shower halted the game for 30 minutes.
Agar, coming back into the side after four years and Lyon took three apiece, giving away 46 and 79 runs, respectively.