Due to the inevitable existence of wireless communication delay, the string stability of cooperative adaptive cruise control (CACC) platoon systems may not be guaranteed if the controller gains are not tuned in time. Most relevant studies discussed how to determine the stable region of controller gains under different communication delays, but seldom told us how to select the optimal gains. Some simulation-based approaches just gave out the feasible gains to meet CACC string stability conditions under different communication delays by using standard input signal (e.g. Sine wave, step function) as the leading vehicle acceleration curve. Unfortunately, as the above approaches did not consider the local traffic characteristics, these feasible gains were not robust enough and even failed when tackling a realistic environment. To this end, this paper proposes a dynamic controller gains tuning algorithm to ensure CACC string stability. First, a synthesized leading vehicle acceleration curve is obtained by performing an inverse fast Fourier transform (IFFT) on the average frequency spectra of 230 vehicles’ acceleration from the next-generation simulation (NGSIM) dataset, which is highly related to the local traffic flow characteristics of the specified road. Then, the ratio of the ∞-norm of the spacing error between the ego vehicle and the preceding vehicle is set as the objective function, and with the synthesized curve as the input of the vehicle platoon, we apply an improved particle swarm optimization (PSO) algorithm to dynamically tune the gains of the CACC controller when the wireless communication delay changes. Hereby, the improved PSO utilizes the nonlinear decreasing inertia weight to accelerate the convergence speed of the algorithm. Finally, three groups of detailed simulation experiments are conducted to verify the effectiveness and performance of the dynamic optimal gains generated by the synthesized curve on string stability and assess the convergence speed of the improved PSO. The experimental results reveal that the proposed algorithm outperforms the traditional methods and can significantly suppress the disturbance along the direction upstream of the platoon.