Liton Das scored his maiden Test century as he, along with Mushfiqur Rahim, helped rebuild the innings after a top-order collapse in the first Test against Pakistan in Chittagong on Friday.
At stumps on day one, Bangladesh were on 253 for 4 in their first innings with Liton unbeaten on 113 and Mushfiqur not out 82.
Opting to bat first, the hosts were in trouble at 49-4 before the duo turned the tide with 204-run unbroken fifth-wicket stand.
Liton led the charge, hitting 11 fours and hoisting off-spinner Sajid Khan over long on for his only six in the innings.
He struck left-arm spinner Nauman Ali to bring up his 10th Test fifty before Mushfiqur followed suit, his 24th in Tests, with a four off Hasan Ali.
Liton, who was dropped on 67 by Sajid at short midwicket off Afridi, completed his maiden Test hundred with a tricky single off left-arm spinner Nauman Ali.
He had to dive to complete the run after pushing Ali at mid-off and a direct hit could have cost him his wicket on 99.
Mushfiqur hugged Liton as he stood back to kiss his helmet and raise his bat responding to applaud from the gallery and the dressing room.
Mushfiqur also batted solidly, hitting 10 fours.
"We had a good first session by taking early wickets. We should appreciate the way Liton Das and Mushfiqur Rahim batted. They played really well," Hasan said.
"It's a slow pitch and we need to bowl in good areas to get break-through. Bangladesh is in a good position at the moment."
Pakistan's bowlers had dominated the opening session as Shaheen Afridi, Hasan Ali, Faheem Ashraf and Sajid each claimed a wicket.
Afridi set the tone for Pakistan with a gem of a delivery in the fifth over that rose sharply to glance off opener Saif Hassan's bat to Abid Ali at short leg. He made 14.
Hasan Ali then trapped the other opener, Shadman Islam, leg-before for 14.
Bangladesh skipper Mominul Haque fell soon afterwards, scoring just six as Sajid spun one sharply to take an edge that was gladly accepted by wicketkeeper Mohammad Rizwan.
The umpire initially declared Mominul not out but the decision was overruled on review.
Najmul Hossain got off the mark with a four but he too soon perished, cutting a Faheem delivery straight to Sajid at the point.
Pakistan handed batsman Abdullah Shafique a Test debut and Yasir Ali was making his Test bow for Bangladesh in the two-match series.
Pakistan: Babar Azam (captain), Mohammad Rizwan (vice-captain, wicketkeeper), Abdullah Shafique, Abid Ali, Azhar Ali, Faheem Ashraf, Fawad Alam, Hasan Ali, Nauman Ali, Sajid Khan and Shaheen Shah Afridi
Bangladesh: Mominul Haque (captain), Shadman Islam, Saif Hasan, Najmul Hossain, Mushfiqur Rahim, Liton Das, Nurul Hasan, Mehidy Hasan Miraz, Nayeem Hasan, Taijul Islam, Ebadot Hossain Chowdhury, Abu Jayed Chowdhury, Yasir Ali, Mahmudul Hasan, Rejaur Rahman.