Hafeez put on an unbeaten 177-run partnership with Azhar Ali (65no) ??? who passed fifty with a six, seven overs before the close ??? with both looking to further eat into Bangladesh???s first innings total on day three in Khulna.
Wahab Riaz (3-55) and Yasir Shah (3-86) had earlier taken two wickets apiece as the hosts added only 96 runs to their overnight score of 236-4.
Shakib Al Hasan (25), Mushfiqur Rahim (32) and Soumya Sarkar (33) will all be disappointed having failed to convert useful starts on a good batting track.
Shakib was the first wicket to fall, smartly caught at leg-slip by Asad Shafiq off slow-left armer Zulfiqar Babar.
Mushfiqur and Sarkar put on 62 runs for the sixth wicket to wrestle the initiative back for the Tigers, only for a spell of three wickets before lunch for just seven runs handed it straight back to the visitors.
Sarkar was dismissed by Hafeez to another good catch by Asad ??? in the covers this time ??? before Yasir accounted for Mushfiqur and Taijul Islam for one.
Wahab blitzed out the tail within three overs after the interval to end Bangladesh???s innings on 332.
In reply, Hafeez and Sami Aslam (20) ??? on Test debut ??? put on fifty for the opening partnership before Aslam glanced a leg-side delivery from Taijul through to the keeper, which was given on review.
Hafeez had earlier been the beneficiary of a review when given out on 13 after edging behind off the same bowler, but the decision was overturned when no edge was detected on replay.
Ali too benefitted from some good fortune, dropped twice by Mushfiqur behind the stumps when on 11 just before tea and 28 in the final session.
The Bangladesh captain would rue his errors as Pakistan added 143 runs in the session after tea, Hafeez passing his hundred and Ali fifty as Pakistan closed the day on 227-1, 105 behind.