To derive P,N-doped cellulose fibrils, phosphoric acid and aqueous ammonia were placed in a one-pot reaction, and the phosphate groups and ammonium phosphates were successfully introduced into the cellulose surface. The obtained P,N-doped cellulose fibrils with high liberation were thereafter incorporated into a high-density polyethylene (HDPE) matrix to improve the flame retardancy of HDPE composites, and they had a significant improvement on flame retardancy of HDPE composites. In particular, 7 wt % P,N-doped cellulose fibrils considerably reduced the average and peak heat release rate (HRR) by 29.6% and 72.9%, respectively, and increased the limited oxygen index (LOI) by 30.5%. The presence of phosphate groups and ammonium phosphates within P,N-doped cellulose fibrils was found to promote the thermal degradation of HDPE composites at a lower temperature (i.e., 240 °C). The released acid catalyzed the dehydration of cellulose to form an aromatic carbonaceous structure with a higher crystalline orientation, which improves the flame retardancy of HDPE composites.