This numerical work examines the impact of an external magnetic field on the hydrothermal aspects of natural convection of a power-law non-Newtonian nanofluid inside a baffled U-shape enclosure. The enclosure is heated from the bottom and cooled from the baffles while the other walls are thermally insulated. Sinusoidal profile is chosen to describe the temperature distribution along the bottom wall. A comprehensive analysis is conducted to study the influence of pertinent parameters including Rayleigh number (Ra), Hartmann number (Ha), nanoparticle volume fraction (phi), aspect ratio of cold baffles (AR), inclination angle, and power-law index (n) on the flow and heat transfer characteristics in detail by using Galerkin finite element method. The obtained results show that the impact of n on the Nusselt number (Nu) is considerable for Ra=10(6) and inappreciable below this value. The influence of n and Ha on the heat transfer is significant when Ha is smaller than 30. For Ha<30, there is a threshold value of nanoparticle after which the rise of n augments heat transfer, which is 5% for AR=0.4 and 7% for AR=0.6.