Afghanistan still trail Bangladesh by 135 runs after the visitors posted 346 in their first innings.
Rahmat remained unbeaten on 84 off 186 deliveries, striking eight fours and a six. Wicketkeeper-batter Ikram Alikhil provided support with an unbeaten 26 off 91 balls as the pair added valuable runs to keep Afghanistan in the contest.
Bangladesh made early inroads, reducing Afghanistan to 30 for one when Sediqullah Atal departed for 17, caught by Tanzid Hasan off Hasan Mahmud. Shahidullah followed at 64 for two, scoring 20 before being caught by Hasan off Ebadot Hossain.
Abdul Malik then joined Rahmat and helped steady the innings with a 70-run partnership for the third wicket. Malik scored 62 off 120 balls, hitting four fours and a six, before Ebadot dismissed him to leave Afghanistan at 134 for three.
Bangladesh struck again shortly afterwards when Hashmatullah Shahidi was stumped by Litton Das off Mehidy Hasan Miraz for a duck. Afghanistan were reduced to 139 for four, but Rahmat and Ikram ensured there were no further setbacks before the close.
Ebadot was Bangladesh’s leading wicket-taker with two wickets, while Hasan and Mehidy claimed one apiece.
Earlier, Bangladesh resumed their first innings on 317 for eight and were eventually bowled out for 346 in 92.3 overs. Nayeem Hasan remained unbeaten on 35, while Taijul Islam added nine before falling to Mohammad Saleem.
Saleem finished with four wickets for 82 runs, while Yamin Ahmadzai claimed three wickets for 79. Ismat Alam took two wickets.
Bangladesh had built their total around contributions from Tanzid Hasan, who scored 83 off 71 balls, and Shadman Islam, who made 67. Litton Das added 53, while Mominul Haque contributed 39.
With six wickets remaining and a deficit of 135 runs, Afghanistan will look to build on Rahmat and Ikram’s partnership when play resumes on day three.