In this study, lightweight polyimide foam (PIF) with anisotropic pore structure were fabricated by adopting microwave-assisted foaming technique. Afterward, lightweight PIF/PI aerogel/silica aerogel (PIF/PIA/SiA) composite foams with anisotropic hierarchical pore structures was prepared by impregnation and directional freeze-drying method. The directional growth of foam pores and ice crystals endowed PIF/PIA/SiA composite foams with anisotropic skeleton structures and hierarchical porous filling structures, leading to anisotropic mechanical and thermal insulation performances. PIF/PIA/SiA composite foams presented mechanical robustness in vertical direction and mechanical flexibility in horizontal direction due to its unique pore structure. In addition, PIF/PIA/SiA composite foams showed outstanding thermal stability and flame retardancy, suggesting a promising application in the field of high temperature fire protection. The PIF/PIA/SiA composite foams exhibited superior thermal insulation performance with thermal conductivities ranging from 0.0253 to 0.0523 W/(m·K) between 25 and 300 °C. Therefore, a facile strategy was developed to fabricate PIF-based composite foams for mechanical, flame retardancy and thermal insulation applications in high-end engineering fields.