In this study, a direct contact membrane distillation (MD) unit was integrated with an anaerobic membrane bioreactor (AnMBR) to simultaneously recover energy and produce high quality water for reuse from wastewater. Results show that AnMBR could produce 0.3–0.5 L/g CODadded biogas with a stable methane content of approximately 65%. By integrating MD with AnMBR, bulk organic matter and phosphate were almost completely removed. The removal of the 26 selected trace organic contaminants by AnMBR was compound specific, but the MD process could complement AnMBR removal, leading to an overall efficiency from 76% to complete removal by the integrated system. The results also show that, due to complete retention, organic matter (such as humic-like and protein-like substances) and inorganic salts accumulated in the MD feed solution and therefore resulted in significant fouling of the MD unit. As a result, the water flux of the MD process decreased continuously. Nevertheless, membrane pore wetting was not observed throughout the operation.