The invention, which belongs to the motion control field, relates to a parameter setting method of a sliding mode controller of a servo system. The method comprises: step one, a transfer function model of a servo system is established according mechanical and electrical structures of the servo system and needed parameters in the model are obtained; step two, a corresponding system simulink simulation model is established and input and output interfaces needed for a particle swarm optimization algorithm are left; step three, a proper fitness function is selected according to location tracking error and speed tracking error demands; step four, programming is carried out in matlab to optimize a particle swarm; step five, corresponding c,k, and epsilon of location vectors are transferred into the simulink simulation model to obtain a location error response and a speed error response of the system; step six, the speed and location of each particle are updated; step seven, when the k reaches a set maximum iterations number, the iteration process is completed and an optimization result is outputted; otherwise, the operation of the step five is carried out again; and step eight, a global optimal location vector is substituted into a sliding mode controller of the servo system. According to the invention, buffeting amplitude minimization or complete elimination of buffeting can be realized; and the tracking error can be minimized.