Hasan Ali also scalped the wicket captain Mominul Haque for a duck to rob the hosts of their advantage.
Mushfiqur Rahim remained unbeaten on 12 alongside debutant Yasir Ali, 8 not out.
Ali earlier made 133 off 282 balls, holding one end for Pakistan for a long stretch after Taijul's early strike of two wickets in two balls in the day's first over.
Faheem Ashraf added 38 late in the innings to keep Pakistan in contention before he was last man dismissed.
Pakistan, who resumed on 145-0 and looked poised for a big total, suffered an early setbackwhen Taijul trapped debutant Abdullah Shafique leg-before on his fifth ball.
Shafique left without adding to his overnight 52, and Taijul took Azhar Ali for a duck in the very next ball when the delivery hit him on the foot.
Azhar was initially given not out but the decision was reversed on review.
Babar Azam saw off the hat-trick ball in Taijul's next over but did not survive long.
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 12 fours and two sixes, was also lucky to survive after he was dropped at slip by Najmul Hossain off Taijul at 113.
He was dropped again by Yasir Ali at forward short leg on 133 but it did not cost Bangladesh much, with Taijul taking him leg before two balls later.
Pakistan had by then lost Mohammad Rizwan to Ebadot Hossain, who bowled 2-47.