Microalgae-based wastewater remediation is aligned with circular economy principals but successful large-scale facilities are scarce due to the limited knowledge of the interactions between all relevant variables and the scarce development of control and automation systems. Machine learning (ML) methods have the potential predict performance in microalgae photobioreactors, with the aim to optimize it. Some attempts have been performed under controlled lab conditions which prevents the direct application of their results to industrial scale. This study aims to develop ML models for the prediction of nutrient removal, biomass production and photosynthetic efficiency using a database obtained from 1.5-y operation of a pilot-scale membrane photobioreactor (MPBR) that treated sewage. A total of 14 inputs and 6 outputs were selected. Random forests (RF), boosted trees (BT), multilayer perceptron (MLP), support vector machine methods (SVM) were tested. The lowest prediction errors were obtained with the MLP model, allowing the developed tool to be used as an alternative to mechanistic models. Large ranges of data were used, considering the variability of factors in the diurnal cycle whose influence on the variability of the data is usually neglected. Using global sensitivity analysis (GSA), input-output relationships were verified, reflecting relevant number of variables showing significant values of Shapley Indices. Additionaly, partial dependence plots showed both linear and nonlinear depending on the selected inputs and outputs. Finally, using ML models, multi-criteria optimization of operating parameters was performed for two variants: a) optimization of operating parameters (HRT, SRT, and air flowrate (Fair)); and b) optimization of operating parameters and influent nutrient loads (HRT, SRT, Fair, nitrogen and phosphorus loading rates).