The water–energy nexus (WEN) has become increasingly important due to differences in supply and demand of both commodities. At the center of the WEN is wastewater treatment plants (WWTP), which can consume a significant portion of total electricity usage in many developed countries. In this study, a novel multigeneration energy system has been developed to provide an energetically self-sufficient WWTP. This system consists of four major subsystems: an activated sludge process, an anerobic digester, a gas power (Brayton) cycle, and a steam power (Rankine) cycle. Furthermore, a novel secondary compressor has been attached to the Brayton cycle to power aeration in the activated sludge system in order to increase the efficiency of the overall system. The energy and exergy efficiencies have been investigated by varying several parameters in both WWTP and power cycles. The effect of these parameters (biological oxygen demand, dissolved oxygen level, turbine inlet temperature, compression ratio and preheater temperature) on the self-efficiency has also been investigated. It was found here that up to 109% of the wastewater treatment energy demand can be produced using the proposed system. The turbine inlet temperature of the Brayton cycle has the largest effect on self-sufficiency of the system. Energy and exergy efficiencies of the overall system varied from 35.7% to 46.0% and from 30.6% to 33.55%, respectively.