The approximate solution of the squeezing axisymmetric fluid flow between infinite plates is discussed in the present paper. An optimal homotopy analysis method with a modification function technique is proposed to solve a class of nonlocal boundary value problems, namely squeezing axisymmetric fluid flow equation. We first transform the nonlocal boundary value problems into an equivalent integral equation, and then the optimal homotopy analysis technique is utilized for an approximate solution. The numerical results confirm the reliability of the present method as it tackles such nonlocal problems without any limiting assumptions. The proposed method is tested upon squeezing axisymmetric fluid flow equation from the literature and the results are compared with the available approximate solutions including perturbation method (Ran et al. in Commun Nonlinear Sci Numer Simul, 2007. 10.1016/j.cnsns), homotopy perturbation method (Ran et al. 2007), homotopy analysis method (Ran et al. 2007), and optimal homotopy asymptotic method (Idrees et al. in Math Comput Model 55:1324-1333, 2012). The convergence and error analysis of the proposed method is discussed. It can be said that squeezing the axisymmetric fluid flow equation exists in different dynamical behaviors. In addition, the physical behaviors of these new exact solutions are given with two and three-dimensional graphs.