To select reasonable PID controller parameters and improve control performances of hydraulic systems, a variable weight beetle antenna search algorithm is proposed for PID tuning in the hydraulic system. The beetle antennae search algorithm is inspired by the beetle preying habit depending on symmetry antennae on the head. The proposed algorithm added the exponential equation mechanism strategy in the basic algorithm to further improve the searching performance, the convergence speed, and the optimization accuracy and obtain new iteration and an updating method in the global searching and local searching stages. In the PID tuning process, advantages of less parameters and fast iteration are realized in the PID tuning process. In this paper, different dimension functions were tested, and results calculated by the proposed algorithm were compared with other famous algorithms, and the numerical analysis was carried out, including the iteration, the box-plot, and the searching path, which comprehensively showed the searching balance in the proposed algorithm. Finally, the reasonable PID controller parameters are found by using the proposed method, and the tuned PID controller is introduced into the hydraulic system for control, and the time-domain response characteristics and frequency response characteristics are given. The results show that the proposed PID tuning method has good PID parameter tuning ability, and the tuned PID has a good control ability, which makes the hydraulic system achieve the desired effect.