Heteroatom doped carbon nanomaterials are often employed as advanced anodes for lithium ion batteries (LIBs) because of their stable structure, high capacity and low cost. In this work, we proposed a novel strategy to synthesize high density (N, Ni, P) tri-doped echinus-like porous carbon spheres (PCS) by carbonizing a metal-organophosphine framework (MOPF) directly. The MOPF employs riboflavin sodium phosphate (C17H20N4NaO9P) as an organic ligand as well as a nitrogen and phosphorus source to conjugate with Ni (NO3)2·6H2O. As an anode for LIBs, PCS was demonstrated with discharge capacities that were able to reach 386.5 mAh·g−1 after 100 cycles at a current density of 0.05 A·g−1. Besides, the stable reversible capacities were obtained from ~459 mAh·g−1 to ∼91.8 mAh·g−1 when the current density was varied from 0.05 to 1A·g−1. The good anode performance is attributed to the unique structure of PCS and (N, Ni, P) tri-doping which introduces the additional capacities due to the presence of the ‘reservoir effect’. Moreover, the electrochemical analysis implied that the surface-limited capacitive behavior dominantly contributes to the lithium ion storage capacity of the PCS anode.