The transition from traditional wastewater treatment plants to biorefineries represents an environmentally and economically sustainable approach to extracting valuable compounds from waste. Sewage sludge produced from wastewater treatment is incinerated or disposed of in specific landfills. Repurposing this waste material to recover valuable resources could help lower disposal costs and reduce environmental impact by producing other beneficial polymers. Microorganisms present in the sewage sludge can ferment organic pollutants, producing volatile fatty acids (VFA), precursors for biopolymers that could be used as an alternative to petroleum-derived plastics. To boost VFA production during sewage sludge fermentation, it is necessary to understand the operating microbial community and its metabolic capacities in anaerobic conditions. This study presents the influence of the headspace volume on the microbial community and the VFA production to define the best operational parameters in a 225 L pilot plant fermenter. The wasted sewage sludge was withdrawn from an oxic-settling-anaerobic plant that collected wastewater from the canteen and dormitory of the UNIPA Campus (Palermo University, Italy) and incubated using a 40% and a 60% headspace volume. The microbial community was analysed before and after the fermentation process through metataxonomic analysis, and VFA yields were determined by gas chromatography analysis. Our results showed that the 40% headspace volume induced a tenfold higher VFA production than the 60% headspace volume, modulating the microbial community's efforts to establish a VFA-producing factory. Notably, at 40% headspace, the relative abundance of bacteria, like Proteobacteria, Firmicutes, Actinobacteria, and Chloroflexi, significantly increased, as well as the relative abundance of Bacteroidetes and Verrucomicrobia decreased during the fermentation process. This result is consistent with the selection of efficient VFA-producing bacteria that lead to increased VFA yields that are not obtained at 60% headspace. Thus, reducing headspace is a promising strategy that can be implemented, even in full-scale plants, to optimise the wastewater reuse process and maximise VFA production to produce bioplastics, like polyhydroxyalkanoate, for the transition from linear wastewater treatment plants to circular biorefineries.