Gardens not only provide people with a place for leisure and relaxation, they also contribute to improving urban ecological environments and promoting social interactions and cohesion. Additionally, from a psychological perspective, gardens play a role in alleviating stress, enhancing happiness, and improving the quality of life. Current research on gardens has primarily employed methods such as questionnaire surveys, environmental psychology analyses, and eye-tracking analyses; however, comprehensive studies on the relationships between multiple factors and levels in garden designs are lacking. Here, we propose a response surface analysis approach based on eye-tracking technology for the design and optimization of gardens. Firstly, the impacts of different garden elements on visitors’ psychology and fixation counts were analyzed using environmental psychology and eye-tracking analyses. Subsequently, the optimal range of each garden feature was determined through single-factor experiments, followed by response surface analysis to obtain the optimal value for each element. The results revealed that changes in garden elements such as the greenery ratio, number of buildings, and water saturation significantly affected visitors’ psychology. The greenery ratio had a greater impact than the number of buildings, which in turn had a greater impact than water saturation. This study is the first to analyze the relationships between multiple garden elements. A strong relationship was found between the greenery ratio and the number of buildings, as well as between the number of buildings and water saturation, while the relationship between the greenery ratio and water saturation was weaker. This approach can not only optimize garden designs but can also be widely applied in fields such as urban planning and public space transformation to enhance visitors’ comfort and satisfaction with the environment and promote sustainable urban development.