Solar stills (SSs) have emerged as highly efficient solutions for converting saline or contaminated water into potable water, addressing a critical need for water purification. This study aims to predict and optimize SS performance, emphasizing the importance of enhancing productivity in various applications, including domestic, agricultural, and industrial settings. Several influencing factors, such as sunlight intensity, ambient temperature, wind speed, and structural design, are crucial in determining SS performance. By harnessing the power of contemporary machine learning techniques, this study adopts Deep Neural Networks, with a special emphasis on the Multilayer Perceptron (MLP) model, aiming to more accurately predict SS output. The research presents a head-to-head comparison of diverse hyperparameter optimization techniques, with Particle Swarm Optimization (PSO) notably outpacing the rest when combined with MLP. This optimized PSO-MLP model was particularly proficient when paired with a specific type of solar collector, registering impressive metrics like a COD of 0.98167 and an MSE of 0.00006. To summarize, this research emphasizes the transformative potential of integrating sophisticated computational models in predicting and augmenting SS performance, laying the groundwork for future innovations in this essential domain of water purification.