In this study, we employed the response surface method (RSM) and the long short-term memory (LSTM) model to optimize operational parameters and predict chemical oxygen demand (COD) removal in the electrocoagulation-catalytic ozonation process (ECOP) for pharmaceutical wastewater treatment. Through RSM simulation, we quantified the effects of reaction time, ozone dose, current density, and catalyst packed rate on COD removal. Then, the optimal conditions for achieving a COD removal efficiency exceeding 50% were identified. After evaluating ECOP performance under optimized conditions, LSTM predicted COD removal (56.4%), close to real results (54.6%) with a 0.2% error. LSTM outperformed RSM in predictive capacity for COD removal. In response to the initial COD concentration and effluent discharge standards, intelligent adjustment of operating parameters becomes feasible, facilitating precise control of the ECOP performance based on this LSTM model. This intelligent control strategy holds promise for enhancing the efficiency of ECOP in real pharmaceutical wastewater treatment scenarios. PRACTITIONER POINTS: This study utilized the response surface method (RSM) and the long short-term memory (LSTM) model for pharmaceutical wastewater treatment optimization. LSTM predicted COD removal (56.4%) closely matched experimental results (54.6%), with a minimal error of 0.2%. LSTM demonstrated superior predictive capacity, enabling intelligent parameter adjustments for enhanced process control. Intelligent control strategy based on LSTM holds promise for improving electrocoagulation-catalytic ozonation process efficiency in pharmaceutical wastewater treatment.