Biogas is a biofuel with a high energy value and basically consisting of methane, which can be used as a renewable energy source as a substitute for natural gas or liquefied petroleum gas. It can be produced by anaerobic digestion of agricultural organic waste or manure in rural areas, where it can be used to generate electric, thermal or mechanical energy. It can also be generated in landfills from the organic fraction of municipal solid wastes and used as an alternative energy source in urban areas. Industrialized and urbanized areas are afflicted by serious environmental problems associated with the generation of organic residues. Anaerobic microorganisms can degrade pollutants resulting in two kinds of products, i.e., digested sludge and biogas, which can be exploited as a soil fertilizer and a renewable energy source, respectively. The correct management of residual waste involves high costs, and inadequate treatment and storage can compromise its quality. Environmental agencies have been encouraging the dissemination of anaerobic digesters to produce biogas from organic residues and the use of the resulting sludge as fertilizer since it is able to destroy pathogenic agents and reduce the humidity level. This review aims to evaluate the production capability of biogas and its application as an alternative energy source in rural and urban areas.