Abstract: Microalgae-based wastewater treatment plants are low-cost alternatives for recovering nutrients from contaminated effuents through microalgal biomass, which may be subsequently processed into valuable bioproducts and bioenergy. Anaerobic digestion for biogas and biomethane production is the most straightforward and applicable technology for bioenergy recovery. However, pretreatment techniques may be needed to enhance the anaerobic biodegradability of microalgae. To date, very few full-scale systems have been put through, due to acknowledged bottlenecks such as low biomass concentration after conventional harvesting and inefficient processing into valuable products. The aim of this study was to evaluate the anaerobic digestion of pretreated microalgal biomass in a demonstration-scale microalgae biorefinery, and to compare the results obtained with previous research conducted at lab-scale, in order to assess the scalability of this bioprocess. In the lab-scale experiments, real municipal wastewater was treated in high rate algal ponds (2 x 0.47 m3), and harvested microalgal biomass was thickened and digested to produce biogas. It was observed how the methane yield increased by 67% after implementing a thermal pretreatment step (at 75 °C for 10 h), and therefore the very same pretreatment was applied in the demonstration-scale study. In this case, agricultural runoff was treated in semi-closed tubular photobioreactors (3 x 11.7 m3), and harvested microalgal biomass was thickened and thermally pretreated before undergoing the anaerobic digestion to produce biogas. The results showed a VS removal of 70% in the reactor and a methane yield up to 0.24 L CH4/g VS, which were similar to the lab-scale results. Furthermore, photosynthetic biogas upgrading led to the production of biomethane, while the digestate was treated in a constructed wetland to obtain a biofertilizer. In this way, the demonstration-scale plant evidenced the feasibility of recovering resources (biomethane and biofertilizer) from agricultural runoff using microalgae-based systems coupled with anaerobic digestion of the microalgal biomass.