The cooling gallery plays an important role in piston cooling. In order to achieve the structural optimization of the cooling gallery, a piston cooling gallery of a common-rail diesel engine is investigated in this paper. A closed 7-order Bezier curve is adopted to describe the cross-section shape of the cooling gallery to establish its flexible sections with a fixed control point by using eight structural design variables. The cross-section shapes investigated include water-drop-shape, oval, circle, and half hamburger, etc. These shapes cover a wide variety of different cooling galleries, and can provide complete guidance for piston cooling design. Meanwhile, there are complex nonlinear constraints relationships among these variables to prevent the cooling gallery sections from exceeding the piston contour. The maximum temperature and the maximum temperature gradient of the piston are taken as the optimization targets in order to find the optimal shape of the cooling gallery. Sobol sequences, Support Vector Machine for Regression (SVR), Pareto optimization, and k-means clustering algorithms are adopted to find the optimal section-profile of the cooling gallery. The predicted results given by the SVR models agree well with those obtained by the simulation method with a high determination coefficient greater than 0.94. One set of the Pareto optimal solutions is obtained through the evolution of 100 generations on the basis of the SVR models. The results reveal that the Pareto optimal solutions are effective due to two optimization thermal targets out of three representative solutions that are partitioned by k-means clustering. Compared with the traditional design, design A reduces the maximum temperature from 369.7 °C to 368.3 °C, while the temperature gradient decreases to 319.4 ℃/m. The temperature of the designs B and C are reduced by 8.6 ℃ and 9.4 ℃, respectively, and the temperature gradients are increased, because the optimization objectives have a trade-off relationship. When the three representative solutions are compared with the solution given by original model, design C has the largest temperature reduction with 2.7%, and design A has the least temperature reduction with 0.7%. However, the temperature gradient of design A decreases by 7.5%, and the temperature gradient of design C decreases by 0.4%. However, the maximum temperature gradient of design B decreases by 2.5% and its maximum temperature reduces by 2.8%. The optimization results reflect an advance of design improvement methodology in the field of piston cooling systems.