The maximum delivery pressure and the maximum rotational speed determine the power density of axial piston pumps. However, increasing the speed beyond the limit always accompanies cavitation, leading to the decrease of the volumetric efficiency. The pressure loss in the suction duct is considered a significant reason for the cavitation. Therefore, this paper proposes a methodology to optimize the shape of the suction duct aiming at reducing the intensity of cavitation and increasing the speed limit. At first, a computational fluid dynamics (CFD) model based on the full cavitation model (FCM) is developed to simulate the fluid field of the axial piston pump and a test rig is set to validate the model. Then the topology optimization is conducted for obtaining the minimum pressure loss in the suction duct. Comparing the original suction duct with the optimized one in the simulation model, the pressure loss in the suction duct gets considerable reduction, which eases the cavitation intensity a lot. The simulation results prove that the speed limit can increase under several different inlet pressures.