This study proposes a comprehensive regulation method of gradient porous metal structure combined with the magnetic field to improve the controllability of heat utilization of latent heat thermal energy storage (LHTES) unit. Melting and solidification are considered. The enthalpy porosity method and magnetic force model describe the phase change of phase change material (PCM) and the movement of Fe3O4 nanoparticles under the magnetic field and assume the local thermal non-equilibrium model of metal foam. The numerical model is consistent with the visual experimental results of melting front evolution. The effects of magnetic nanoparticle concentration and gradient porosity on heat transfer and thermal energy change during melting and solidification are numerically studied. The results show that the phase change rate increases with the concentration of nanoparticles. The positive magnetic field further accelerates the phase change and heat energy change. The addition of copper foam considerably shortened the phase change time. The positive magnetic field accelerated the melting and heat energy change rate of PCM in copper foam by 18.2% and 23.1%, but the improvement of solidification was weak. Based on magnetic field promotion, the setting of porosity spacing with different gradients can regulate the phase interface uniformity, total heat energy, and heat energy change rate. Finally, according to different heat utilization scenarios of the LHTES system, this study gives recommended cases to optimize the performance of melting, solidification, and the phase change cycle.