Chasing a record 437 for victory, Pakistan were reduced to 7-316 by stumps on Tuesday.
No.7 batter Mohammad Rizwan, on 75, was the last realistic hope for the visitors, with Sajid Khan with him on eight.
Salman Agha and skipper Shan Masood added 71 runs each to help Pakistan take the Test to a fifth day.
"There is hope, of course," Pakistan batting coach Asad Shafiq said. "The way our batting unit performed today gives us confidence. There are 121 runs left and Rizwan is batting really well. ... If another partnership develops and goes long, we have a chance."
Left armer Taijul put Bangladesh on top, breaking the threatening partnership of Agha and Rizwan, who shared 134 runs for the sixth wicket to give Pakistan a glimmer of hope.
Taijul bowled Agha with a slider to break the stubborn rearguard before removing Hasan Ali for duck.
Fast bowler Nahid Rana took 2-58 with raw pace that troubled Pakistan throughout the day. He gave Bangladesh the first breakthrough when he dismissed Abdullah Fazal (6), who steered a short-pitched ball to gully.
Soon after, off-spinner Mehidy Hasan trapped Azan Awais lbw for 21.
Masood and Babar Azam added 91 before Taijul had Babar caught behind down the leg side for 47.
Saud Shakeel then edged a pacy delivery off Nahid while Taijul had Masood caught at short-leg, leaving Pakistan 6-162 as Bangladesh sensed a victory inside four days.
"That was a warrior effort from Taijul, to bowl all day in those conditions and then take the new ball at the end and get those wickets was fantastic," Bangladesh's Australian bowling coach Shaun Tait said.
"They got on top of us for a period of time, but taking those two wickets late in the day means we go back to the dressing room fairly happy."