With regard to the lane keeping system, path tracking accuracy and lateral stability at high speeds need to be taken into account especially for commercial vehicles due to the characteristics of larger mass, longer wheelbase and higher mass center. To improve the performance mentioned above comprehensively, the control strategy based on improved artificial potential field (APF) algorithm is proposed. In the paper, time to lane crossing (TLC) is introduced into the potential field function to enhance the accuracy of path tracking, meanwhile the vehicle dynamics parameters including yaw rate and lateral acceleration are chosen as the repulsive force field source. The lane keeping controller based on improved APF algorithm is designed and the stability of the control system is proved based on Lyapunov theory. In addition, adaptive inertial weight particle swarm optimization algorithm (AIWPSO) is applied to optimize the gain of each potential field function. The co-simulation results indicate that the comprehensive evaluation index respecting lane tracking accuracy and lateral stability is reduced remarkably. Finally, the proposed control strategy is verified by the HiL test.