Abid Ali made his fourth Test hundred but spinners made quick strikes to keep Bangladesh's hopes alive by lunch on the third day against Pakistan on Sunday.
Taijul Islam claimed three, including back-to-back wickets in the first over of the morning at the first Test in Chittagong, as Bangladesh held the tourists to 203-4.
Mohammad Rizwan was accompanying him with five runs, while Pakistan trailed Bangladesh's first innings total of 330 by 127 runs.
Pakistan, who resumed on 145-0 and looked poised for a big total, suffered a setback very early when Taijul trapped debutant Abdullah Shafique leg-before in the fifth ball of the day.
Shafique left without adding to his overnight 52.
Taijul dismissed one-down Azhar Ali for a duck in the next ball when the delivery hit him on the foot.
Azhar was initially given not out but the decision was reversed on review.
Mehidy uprooted his off-stump with a straight delivery after the Pakistan skipper made only 10 runs.
Taijul grabbed his third wicket when he beat Fawad Alam with spin to remove the batsman for eight.
Bangladesh sought a review after the umpire turned down a confident caught-behind appeal.
The replay indicated the ball took a feather touch on Alam's glove, ending his brief stay at the crease.
Ali, who struck 11 fours and two sixes so far, was also lucky to survive after he was dropped at slip by Najmul Hossain off Taijul at 113.