A mesoscopic method based on a lattice Boltzmann method (LBM) for simulation of Newtonian and non-Newtonian nanofluids has been introduced. This investigation is a continuation of our recent study [G. H. R. Kefayati and A. Bassom, “A lattice Boltzmann method for single and two phase models of nanofluids: Newtonian and non-Newtonian nanofluids,” Phys. Fluids 33, 102008 (2021)], which proposed a two-dimensional LBM for a non-homogeneous model of nanofluids with Brownian diffusion and thermophoresis. Here, this model is improved by considering thermodynamic consistency, deposition rate, nanoparticle thermal dispersion, and hydrodynamic interactions around the nanoparticles, which are evaluated and reported in some thermodynamic and experimental observations. The proposed method is also developed for three-dimensional cases, applying all the above-mentioned elements. The revised macroscopic governing equations of mass (one for the carrier fluid and the other for the nanoparticles), momentum, and energy by considering the newly mentioned elements are presented, and then the proposed LBM, which has the ability to recover equations, is introduced while the derivations and proofs are provided. Different elements of the present code are validated with previous studies and demonstrated good agreement. To apply and evaluate the model in a case study, natural convection of Newtonian, shear-thinning, and viscoplastic nanofluids in a side-heated two-dimensional square enclosure and in a cubic cavity are investigated. The results for various volume fractions of nanofluids and Grashof numbers are shown in the formats of isotherms, streamlines, nanoparticle distributions, and local and average Nusselt numbers on the hot wall. In addition, the yielded/unyielded regions for viscoplastic nanofluids are defined and depicted.