This paper addresses the position control of valve-controlled cylinder system employed in hydraulic excavator. Nonlinearities such as dead zone, saturation, discharge coefficient and friction existed. in the system are highlighted during the mathematical modeling. On this basis, simulation model is established and then validated against experiments. Aim for achieving excellent position control performances, an improved particle swarm optimization (PSO) algorithm is presented to search for the optimal proportional-integral derivative (PID) controller gains for the nonlinear hydraulic system. The proposed algorithm is a hybrid based on the standard PSO algorithm but with the addition of selection and crossover operators from genetic algorithm in order to enhance the searching efficiency. Furthermore, a nonlinear decreasing scheme for the inertia weight of the improved PSO algorithm is adopted to balance global exploration and local exploration abilities of particles. Then a co-simulation platform combining the simulation model with the improved PSO tuning based PID controller is developed. Comparisons of the improved PSO, standard PSO and Phase Margin (PM) tuning methods are carried out with three position references as step signal, ramp signal and sinusoidal wave using the co-simulation platform. The results demonstrated that the improved PSO algorithm can perform well in PID control for positioning of nonlinear hydraulic system. (C) 2016 Elsevier Ltd. All rights reserved.