Nickel phosphides are considered to be a promising lithium storage host due to their high theoretical capacities. However, the volume change during the charge-discharge process and inherent poor reaction kinetics limit their electrochemical performance. To solve these problems, Ni/Ni2P heterostructures encapsulated in 3D porous carbon networks are fabricated. The macro/micro-pores-rich carbon networks are in situ constructed via a freeze-drying method and subsequent pyrolysis route using NaCl as a template. In the following phosphorization process, Ni/Ni2P nanoparticles are homogenously embedded in the carbon matrix. When used as anodes for lithium ion batteries, the Ni/Ni2P/porous carbon networks deliver high discharge capacity, good cycling stability as well as good rate performance. It is believed that metallic Ni and porous carbon networks significantly improve the conductivity of electrodes. Moreover, the 3D conductive matrix can not only alleviate the volume change, but also prevent the aggregation and pulverization of Ni2P nanoparticles during the charge-discharge process.