There is great potential to apply energy recovery from municipal wastewater treatment plants (WWTP) to achieve better energy efficiency and greenhouse gas emissions abatement. However, in most of the wastewater treatment plants that produce biogas through sludge digestion, there is no thermal energy recovery or electricity generation, and the biogas is flared and wasted, particularly in developing countries. This paper discusses the recent technological advances related to biogas recovery from wastewater treatment besides identifying research gaps and local conditions, which affect implementation. Techniques for enhancement of biogas production such as co-digestion and microalgae systems for energy recovery were reviewed in terms of performance and context for application. This paper provides an assessment of how local conditions promote or hinder biogas recovery from WWTP in megacities of developing countries. The lack of government subsidies and a biogas market that is not well developed and regulated hinder biogas recovery implementation in the studied megacities. Infrastructure and electricity prices are also discussed. Strategies to promote energy recovery are recommended based on successful examples of energy self-sufficient WWTP. The findings may not only support planning on energy recovery but also guide technological development and research on this topic, aligned with the sustainable development goals.