Optical structure parameter design is of great importance to ensure the accuracy of asymmetry systems such as the laser triangulation ranging system. The result often depends on the experience of optical designers, and it is inevitable to introduce human errors. In this paper, an automatic optimization method of optical structure parameters applied to the laser triangulation ranging system was proposed to assist in improving the measurement accuracy. First, the optical sensitivity optimization model of the laser triangulation ranging system was constructed, and the boundary conditions were established from two aspects of laser clear imaging and sensor geometric dimension. The constraint relationship between optical structure parameters under the Scheimpflug rule was established to ensure clear laser imaging, and the transverse distance and axial distance of the sensor geometric dimension were constrained when the laser imaging length was taken into consideration. Secondly, mutation operator-based particle swarm optimization (M-PSO) algorithm was proposed to search the optimal optical sensitivity, and three typical working distances and ranges were taken as examples to design the optical parameters. In addition, the results were verified by ZEMAX simulation and also the experimental platform, the maximum optical sensitivity of the structure was 3.496 and its corresponding optimal nonlinearity was 0.039% F.S. The automatic optimization method proposed in this paper was compared with the traditional GA method and PSO method, and it was verified that the convergence efficiency of the proposed method was much higher than the traditional ones.