In this research, the multi-layered porous foam is used to improve the performance of a heatsink from the hydrothermal and entropy generation perspectives. The research is done numerically using the computational fluid dynamics method. The results are compared with the case of single-layer metal foam and the case without metal foam. For the multi-layered foam, two modes are considered: the permeability of layers gradually increases or decreases by moving away from the CPU. The analysis showed that if the permeability of foam layers gradually decreases by moving away from the CPU, the heatsink has the best uniformity of temperature distribution, the lowest thermal resistance, the highest convection coefficient, and in general, the best overall hydrothermal performance. Also, it was seen that the multilayered foam whose layer permeability increases by moving away from the CPU has the lowest frictional entropy, the highest thermal entropy, and the lowest total entropy generation rate. The frictional, thermal, and total entropy generation rates were respectively 64.51%−73.02% lower, 42.80%−220.34% higher, and 19.68%−62.36% lower than that of the heatsink without metal foam.