We study the dynamics of the giant elliptical galaxy M87 from the central to the outermost regions with the made-to-measure (M2M) method. We use a new catalogue of 922 globular cluster line-of- sight velocities extending to a projected radius of 180 kpc (equivalent to 25 M87 effective radii), and SAURON integral field unit data within the central 2.4 kpc. 263 globular clusters, mainly located beyond 40 kpc, are newly observed by the Next Generation Virgo Survey (NGVS). For the M2M modelling, the gravitational potential is taken as a combination of a luminous matter potential with a constant stellar mass-to-light ratio and a dark matter potential modelled as a logarithmic potential. Our best dynamical model returns a stellar mass-to-light ratio in the I band of M/LI = 6.0(+ -0.3) M_sun/L_sun with a dark matter potential scale velocity of 591(+ -50) km/s and scale radius of 42(+ -10) kpc. We determine the total mass of M87 within 180 kpc to be (1.5 + - 0.2) 10^13 M_sun. The mass within 40 kpc is smaller than previous estimates determined using globular cluster kinematics that did not extend beyond 45 kpc. With our new globular cluster velocities at much larger radii, we see that globular clusters around 40 kpc show an anomalously large velocity dispersion which affected previous results. The mass we derived is in good agreement with that inferred from ROSAT X-ray observation out to 180 kpc. Within 30 kpc our mass is also consistent with that inferred from Chandra and XMM-Newton X-ray observations, while within 120 kpc it is about 20% smaller. The model velocity dispersion anisotropy beta parameter for the globular clusters in M87 is small, varying from -0.2 at the centre to 0.2 at 40 kpc, and gradually decreasing to zero at 120 kpc.