
Rahmat negotiated Bangladesh bowlers astutely throughout the day to remain not out on 84, steering Afghanistan to 211-4 at stumps. Ikram Ali Khil was on 26 after adding 72 runs with the skipper for an unbroken fifth wicket.
Afghanistan are still trailing by runs 135 runs.
Bangladesh were bowled out for 346 in its first innings, riding on half-centuries from openers Tanzid Hasan Tamim (83), Shadman Islam (67) and wicket-keeper batter Liton Das (53).
The platform of Afghan resurgence was set by opener Abdul Malik, who hit his maiden half-century before being out on 62.
Afghanistan began watchfully and kept Bangladesh waiting for 11 overs for the first wicket.
Hasan Mahmud, the hero of Darwin Test victory over Australia, gave the side the breakthrough, getting rid of Sediqullah Atal for 17.
The stubbornness of Malik made Bangladesh toiling before Ebadot struck with the wicket of Shahidullah who made 20.
However, Rahmat joined Malik to keep Bangladesh bowlers at bay, denying them making further inroads.
Bangladesh heaved a sigh of relief in the last session when they got two wickets in quick succession.
Ebadot struck again with a delivery that carried extra bounce and Malik edged behind, ending a 70-run partnership with Rahmat.
Two overs later, Mehidy Hasan Miraz had Hasmathullah Shahidi stumped for duck, leaving Afghanistan 139-4.
Bangladesh appeared to take the stranglehold from that stage. But Rahmat, with apt support from Ikram Alikhil defied Bangladesh attack to leave the side unscathed till the stumps.
Ebadot was the most successful bowler for Bangladesh with 2-50 while Hasan and Miraz picked up one wicket apiece.
Earlier, Bangladesh added 29 runs to their overnight total of 317-8, with overnight unbeaten batter Nayeem Hasan scoring most of the runs to remain unbeaten on 35.
Afghan pacer Mohammad Saleem claimed the wicket of Taijul Isalm for 9 to finish with team-best 4-82.
Yamin Ahmadzai dismissed Ebadot Hossain for duck, snapping up 3-79, reports BSS.