As one of the most important wheat-producing areas in China, wheat is prone to heat stress during the grain filling period in the Huang-Huai-Hai Plain (3HP), which lowers yields and degrades the grain quality of wheat. To assess the effects of spraying potassium dihydrogen phosphate (KH2PO4) on the physiological traits in flag leaves and grain yield (GY) and quality under heat stress during the filling period, we conducted a two-year field experiment in the winter wheat growing seasons of 2020–2022. In this study, spraying water combined with heat stress (HT), 0.3% KH2PO4(KDP), and 0.3% KH2PO4combined with heat stress (PHT) were designed, and spraying water alone was used as a control (CK). The dates for the spraying were the third and eleventh day after anthesis, and a plastic film shed was used to impose heat stress on the wheat plants during the grain filling period. The results showed that spraying KH2PO4significantly improved the chlorophyll content and net photosynthesis rate (Pn) in flag leaves compared with the non-sprayed treatments. Compared with CK, the Pn in HT decreased by 8.97% after heat stress, while Pn in PHT decreased by 7.44% compared to that of KDP. The activities of superoxide dismutase, catalase, and peroxidase in flag leaves were significantly reduced when the wheat was subjected to heat stress, while malonaldehyde content increased, and the enzyme activities were significantly enhanced when KH2PO4was sprayed. Heat stress significantly decreased the contribution rate of dry matter accumulation (DM) after anthesis of wheat to grain (CRAA), whereas spraying KH2PO4significantly increased the CRAA and harvest index. At maturity, the DM in CK was significantly higher than that in HT, KDP was significantly higher than PHT, and KDP had the highest DM. Compared with CK, the GY in KDP significantly increased by 9.85% over the two years, while the GY in HT decreased by 11.44% compared with that of CK, and the GY in PHT decreased by 6.31% compared to that of KDP. Spraying KH2PO4after anthesis primarily helped GY by maintaining a high thousand grain weight to lessen the negative effects of heat stress on wheat. Moreover, heat stress significantly reduced protein concentration, wet gluten content, dough development time, and hardness index in grains of mature, while spraying KH2PO4maintained a sufficient grain quality under the conditions of achieving higher yields. Overall, spraying KH2PO4after anthesis could enhance the heat stress resistance of wheat and maintain the photosynthetic capacity of flag leaves, ensuring the dry matter production and reducing the negative effects on grain yield and quality in the 3HP.