In this study, the viscosity of MgO-Water nanofluid in a different volume fraction of nanoparticles, temperatures, and shear rates has been predicted by Artificial Neural Networks (ANNs) and surface methods. In the ANN method, an algorithm is proposed to select the best neuron number for the hidden layer. In the fitting method, a surface is proposed for each volume fraction of nanoparticles, and finally, the results of ANN and surface fitting method have been compared. It can be observed that, increasing the volume fraction from 0.07% to 1.25% at temperatures of 25, 30, 40, 50, and 60 °C resulted in about two-fold increase in viscosity. Also, the best network has 24 neurons in the hidden layer. It can be seen that for a network with 24 neurons in the hidden layer has the best overall correlation, and this coefficient is 0.999035. The mean absolute value of errors in ANN and fitting method are 0.0118 and 0.0206, respectively.