Based on our gait research of the C-legged hexapod robot as it climbs stairs and our analysis of the key factors affecting the robot's climbing efficiency, we propose a gait control method for optimizing the stair-climbing path. First, we establish a simulation environment and a mechanical model of the climbing process of the C-legged hexapod robot. We determine that the position of the robot's center of mass has a critical role in climbing stairs when the robot chassis is at a maximum angle with respect to the stair surface. We then analyze the influence of the contact position between the middle leg and the stair surface on the movement efficiency of the robot. We find that when the gait of the hexapod robot is in the mode of climbing stairs continuously, the climbing path can be divided into two parts for optimization. On this basis, we study the gait of the robot to determine the optimized path. The simulation and experimental results show that the proposed gait method enables the C-legged hexapod robot to climb stairs successfully and efficiently, thereby verifying the reliability and effectiveness of this method.