Advanced polymer dielectrics with high energy density at elevated temperatures are highly desired to meet the requirements of modern electronic and electrical systems under harsh conditions. Herein, we report a novel polyimide/magnesium oxide (PI/MgO) nanodielectric that exhibits high energy storage density (Ue) and charge–discharge efficiency (η) along with excellent cycling stability at elevated temperatures. Benefiting from the large bandgap of MgO and the extended interchain spacing of PI, the composite films can simultaneously achieve high dielectric constant and high breakdown strength, leading to enhanced energy storage density. The nanocomposite film doped with 0.1 vol% MgO can achieve a maximum Ue of 2.6 J cm−3 and a η of 89% at 450 MV m−1 and 150 °C, which is three times that of the PI film under the same conditions. In addition, embedding ultralow content of inorganic fillers can avoid aggregation and facilitate its large-scale production. This work may provide a new paradigm for exploring polymer nanocomposites with excellent energy storage performance at high temperatures and under a high electric field.