Bismuth (Bi) based materials are widely utilized in potassium-ion batteries (PIBs) due to their high theoretical capacity; however, they undergo severe volume changes during electrochemical processes. To develop Bi-based anode with extended lifespan, Bi nanoparticles and porous carbon materials were composited by a template method in this study. N-doped three-dimensional porous carbon coated Bi nanoparticles (Bi@3DNC) composites were successfully synthesized by using sodium chloride as a template and anchoring Bi nanoparticles on a porous carbon skeleton. Bi@3DNC exhibits excellent electrochemical performance as an anode material for PIBs, retaining a capacity of 273 mAh/g after 700 cycles at 1 A/g. We elucidate that the 3D porous carbon mesh serves to confine the alloying particles and buffer the volume expansion of the metal during continuous K+ de-intercalation, while also enhancing the availability of active sites. This strategy offers promising prospects for the development of advanced metal based anodes for PIBs.