Rahim scored 127 as Bangladesh were all out 299 runs short of India's first innings score of 687/6 declared.
However, with the Indian bowlers having sent down 127.5 overs, skipper Virat Kohli decided against enforcing a follow-on.
In the one over before lunch, India were 1 for no loss.
With the Bangladesh tail showing stomach for a fight frustrating the Indian bowlers, Ashwin's (2/98 in 28.5 overs) agonising wait for world record ended when Mushfiqur's paddle sweep was caught down the leg by Wriddhiman Saha. Ashwin was playing in his 45th Test match.
Also Read
The century came off a flick which Ishant Sharma misfielded and it crossed the boundary ropes much to the batsman's elation.
The two other shots that he played in the morning included a hooked six off Ishant, which he was not in control and a swat off Ashwin over the ropes in the cow corner region.
The Bangladesh skipper should be given due credit in the manner he batted with the tail after young Mehedi Hasan Miraz (51) was cleaned up by Bhuvneshwar Kumar (1/52) on his overnight score, with an incoming delivery that reversed.
In fact, Mushfiqur at times took the risk of taking single off the first or second delivery exposing Taijul to Ishant, who was getting the ball to rear from back of length.
Taijul was uncomfortable while facing the short balls and had two streaky boundaries before he tried to fend a rising delivery from Umesh in an ugly manner to give Wriddhiman a simple catch.
Jadeja finally got rid of Taskin with Rahane taking a catch at slips.
In the end, it was Ashwin, who got his 250th scalp after being frustrated for the better part of the innings.
Disclaimer: No Business Standard Journalist was involved in creation of this content