Numerical simulation of natural convection heat transfer in the presence of a magnetic field is analyzed in a non-isothermally heated square enclosure. The left wall is heated and cooled with a sinusoidal heat source and the right wall is cooled isothermally. The horizontal walls of the enclosure are adiabatic. The effects of Rayleigh number (Ra = 104, 105 and 106), Hartmann number (Ha = 0, 25, 50 and 100) and amplitude of sinusoidal function (n = 0.25, 0.5 and 1) on temperature and flow fields are analyzed. It is observed that the rate of heat transfer is decreased with increasing the Hartmann number; it is also decreased when decreasing the amplitude of sinusoidal function.