Recently, a great amount of research was done on wavy conduits due to the importance of heat and flow transfer in wavy channels and conduits, and their special use in various industries. The improvement of heat transfer in these ducts attracted the attention of many researchers, and experimental and numerical studies are devoted. The effect of the presence of a porous medium and magnetic field on forced convection heat transfer and a nanofluid flow in a complex wave-shaped channel with a special boundary condition (Non-uniform with respect to location) was studied for the first time. For this purpose, the heat transfer of a nanofluid in a two-dimensional sinusoidal channel containing a porous medium in the attendance of a magnetic field was analyzed. First, the nanoparticles were optimized using the design of the experiment method, and then modeling was performed using selected optimal particles. To improve heat transfer in a sinusoidal channel, the factors like the injection of optimized nanoparticles, porous medium, and magnetic field usage were used. The equations were discretized using the Fluent software with a finite volume method. The validation of problem outcomes was done using experimental and numerical studies. Porous medium in four different Darcys (10−5, 10−4, 10−3, and 10−2), and applying magnetic fields in four different Hartman (0, 4, 7, and 10) were examined. The results show that the channel wave, and magnetic field intensity improved heat transfer. Furthermore, using a porous medium with high Darcy can increase the Nusselt number. Hence, in the same conditions (Re = 500, Ha = 10) with Darcy number increasing from 10−5 to 10−2, Nu becomes equal to 5.011. This proposed system is an industrial-utility system that can increase heat transfer efficiency.