We report new constraints on the local escape speed of our Galaxy. Our analysis is based on a sample of high-velocity stars from the RAVE survey and two previously published data sets. We use cosmological simulations of disc galaxy formation to motivate our assumptions on the shape of the velocity distribution, allowing for a significantly more precise measurement of the escape velocity compared to previous studies. We find that the escape velocity lies within the range 498 < vesc < 608 km s⁻¹ (90 per cent confidence), with a median likelihood of 544 km s⁻¹. The fact that v²esc is significantly greater than 2v²circ (where vcirc= 220 km s⁻¹ is the local circular velocity) implies that there must be a significant amount of mass exterior to the solar circle, that is, this convincingly demonstrates the presence of a dark halo in the Galaxy. We use our constraints on vesc to determine the mass of the Milky Way halo for three halo profiles. For example, an adiabatically contracted NFW halo model results in a virial mass of 1.42⁺¹⋅¹⁴₋₀.₅₄× 10¹² M⊙ and virial radius of 305⁺⁶⁶₋₄₄ kpc (90 per cent confidence). For this model the circular velocity at the virial radius is 142⁺³¹₋₂₁ km s⁻¹. Although our halo masses are model dependent, we find that they are in good agreement with each other.