Wastewater treatment plants designed to meet the requirements of discharging wastewater to a receiving water body are often not energy optimised. Energy requirements for conventional activated sludge wastewater treatment plants are estimated to range from 0.30 to 1.2 kWh/m3, with the highest values achieved using the nitrification process. This article describes the energy optimisation process of the wastewater treatment plant in Gubin (Poland) designed for 90 000 PE (population equivalent) using renewable energy sources: solar, biogas, and geothermal. At the analysed wastewater treatment plant electricity consumption for treating 1 m3 of wastewater was 0.679 kWh in 2020. The combined production of electricity and heat from biogas, the production of electricity in a photovoltaic system, and heat recovery in a geothermal process make it possible to obtain a surplus of heat in relation to its demand in the wastewater treatment plant, and to cover the demand for electricity, with the possibility of also selling it to the power grid.