The porosity of oil-impregnated porous polyimide is closely related to its tribological and mechanical properties, which is critical to determine the application and service life. Herein, polyimides with different porosities are fabricated by mixing different contents of pore-forming agent to investigate the significance of porosity with dimethyl silicone oil as impregnated lubricant. The dynamic porosity was simulated to explain the selflubricating mechanism. Results show that the increasing porosity results in a higher oil content and the oil can be easily extruded, but leads to a poor bearing capacity and a higher friction coefficient, and vice versa. The friction coefficient reduced by 46.15% with the optimized porosity of 20.05%. This study may provide guidance for the development of high-performance oil-impregnated polymers.