Najmul Hossain struck an unbeaten 112 for his second match century to guide Bangladesh to 255-2 at lunch on Friday's third day of their one-off Test against Afghanistan.
The batsman added to his 146 runs in the first innings, becoming only the second Bangladeshi to score a hundred in both innings of a Test match after Mominul Haque.
Mominul watched the feat from the non-striking end and was unbeaten on 43 at the break as Bangladesh stretched their lead to 491 runs with no sign of a declaration.
Najmul put on 173 runs with Zakir Hasan for the second wicket before the latter was run out for 71.
Resuming from 134-1 overnight, the duo batted with confidence before Afghanistan got the unexpected breakthrough against the run of play.
An edge from the bat of Najmul raced to the boundary line, where Nasir Jamal stopped the ball and relayed it to Ibrahim Zadran.
Ibrahim's direct hit found Zakir, who was running for the third, well short, ending their free-flowing partnership.
Zakir hit eight boundaries in his second Test fifty, playing only his third Test.
Najmul was prolific at the other end, bringing his hundred with a single off Hashmatullah Shahidi in 115 balls.
Bangladesh scored 382 runs in the first innings and bowled out Afghanistan for 146.
Afghanistan won the only other Test between the two teams when they beat the home side by 224 runs at Chittagong in 2019.