Lithium (Li) metal batteries with remarkable energy densities are restrained by short lifetime and low Coulombic efficiency (CE), resulting from the accumulative Li dendrites and dead Li during cycling. Here, we prepared a new three-dimensional (3D) covalent organic framework (COF) with dense lithiophilic sites (heteoatom weight contents of 32.32wt%) as an anodic protective layer of Li metal batteries. The 3D COF was synthesized using a [6+4] synthesis strategy by inducing flexible 6-connected cyclotriphosphazene derivative aldehyde and 4-connected porphyrin-based tetraphenylamines. Both phosphazene and porphyrin rings in the COF served as electron-rich and lithiophilic sites, enhancing a homogeneous Li+ flux via 3D direction towards highly smooth and compact Li deposition. The Li/Por-PN-COF-Cu cells achieved a record average CE of 99.1% for 320 cycles with smooth Li deposition. Meanwhile, the abundant lithiophilic sites can promote fast Li+ transport with Li+ transference number of 0.87, enabling LiFePO4 full cell with stable stripping/plating processes even at a harsh rate of 5 C. Theoretical calculations revealed that the strong interaction force between Li+ and the COF facilitated the dissolution of Li+ from the electrolyte, and the low migration barrier of 1.08 eV indicated a favorable interaction between the Li+ ions and the π-electron system.