The Shulhan Aruch (Orah Haim 184:5) rules that one may recite Birkat Hamazon as long as one is still satiated from that meal and does not feel hungry. This ruling applies to other Berachot Aharonot (after–blessings) for other foods as well. Since the sensation of satiety and hunger are subjective, the Mishna Berura (O.H. 184:20) writes that commonly accepted custom of the Aharonim is that one has 72 minutes to recite a Beracha Aharona, including “Asher Yatzar”.
It should be noted that Beracha Rishona and Beracha Aharona are not necessarily linked with regards to time limits. For example, if one does not recite Birkat Hamazon within the 72-minute window and loses the opportunity to recite it, it is plausible that one can eat more bread without having to recite “Hamotzi”. This refers only to a case in which one does not takes one’s mind off the bread and thus it would apply to any future bread. Rabbi Ovadia Yosef (Hazon Ovadia, Hilchot Berachot) gives an example of one who recites “Shehakol” for tea while one spends the day learning; even though one may have surpassed the 72-minute window for the Beracha Aharona, one may continue drinking throughout one’s learning so long as one does not take one’s mind off the tea.
Although the general consensus is 72 minutes with regards to Beracha Aharona, it is plausible that one could begin to feel hungry even before this time. Indeed, the Kaf HaHaim explains that the limit to recite Birkat Hamazon is actually only thirty minutes. Furthermore, strictly speaking, one may recite Birkat Hamazon on bread if one still feels satiated, even beyond 72 minutes, whereas one would need to recite a Beracha Aharona on other foods before 72 minutes. If one is unsure about one’s satiety, then one can certainly rely on the 72 minutes. If one is sure that one is hungry after eating but is still within the 72 minutes, it is recommended that one eat some more and then make a Beracha Aharona or Birkat Hamazon. Rabbi Ben Zion Abba Shaul (Or LeZion, vol.II), however, says that, since the parameters of Beracha Aharona are unclear, one should preferably make a Beracha Aharona or Birkat Hamazon as soon as one is done eating.
Summary: The commonly accepted practice is that one may recite Birkat Hamazon or any other Beracha Aharona within 72 minutes of consuming the food or drink.