Pakistan were on top at stumps on Day 2. However, Taijul Islam ran through the visitors' batting lineup on Sunday - his seven wicket-haul gave Bangladesh a crucial first-innings lead before Shaheen Afridi and Hasan Ali wrestled back control for Pakistan.
Resuming at 145 for no loss on Day 3 with Abid Ali batting on 93 and Abdullah Shafique on 52, Pakistan had a terrible start as Taijul Islam trapped Abdullah Shafique and Azhar Ali in front of the stumps off consecutive deliveries in the very first over.
Abid Ali soon got to his century, his fourth in Test cricket, but he kept losing partners at the other end. Mehidy Hasan Miraz went through Babar Azam's defence and rattled the off-stump while Islam dismissed Fawad Alam for 8.
Pakistan went in for lunch at 203/4, adding only 58 runs to their overnight score while losing four wickets. Bangladesh struck immediately after the break, with Ebadat Hossain trapping Mohammad Rizwan plumb in front of the stumps.
Abid Ali soon followed him back to the pavilion. Hasan Ali showed some intent and took Taijul on for a six and a four off consecutive balls. But it was the left-arm spinner who had the last laugh as he got Ali out stumped to complete his ninth Test five-wicket haul.
Sajid Khan and Nauman Ali's stay at the crease was cut short by Hossain and Taijul respectively. Still, 73 runs behind Bangladesh's first innings score at that point, Pakistan's last-wicket pair of Shaheen Shah Afridi and Faheem Ashraf added a crucial 29 runs to reduce the lead to 44. Taijul scalped the final wicket, with Ashraf departing after a vital knock of 38.
After conceding a first innings lead, Pakistan responded brilliantly with the pacers tearing through Bangladesh's top four. Afridi broke through for Pakistan, dismissing Shadman Islam leg before the wicket. Two balls later, Najmul Hossain Shanto had to walk back to the hut without troubling the scorers, edging the ball to Abdullah Shafique in slips.
Hasan Ali got skipper Mominul Haque for naught the very next over, with Azhar Ali taking a good diving catch at mid-wicket. The Tigers lost Saif Hassan right after the drinks break to a ripper of a short ball from Afridi.
Yasir Ali and Mushfiqur Rahim survived the remaining nine overs of the day as Bangladesh went to stumps on 39/4 with their lead at 89 runs.