  We analyze the problem of extracting the correlation length from infinite
matrix product states (MPS) and corner transfer matrix (CTM) simulations. When
the correlation length is calculated directly from the transfer matrix, it is
typically significantly underestimated for finite bond dimensions used in
numerical simulation. This is true even when one considers ground states at a
distance from the critical point. We introduce extrapolation procedure to
overcome this problem. To that end we quantify how much the dominant part of
the MPS/CTM transfer matrix spectrum deviates from being continuous. The latter
is necessary to capture the exact asymptotics of the correlation function where
the exponential decay is typically modified by an additional algebraic term. By
extrapolating such a refinement parameter to zero, we show that we are able to
recover the exact value of the correlation length with high accuracy. In a
generic setting, our method reduces the error by a factor of $\sim 100$ as
compared to the results without extrapolation and a factor of $\sim 10$ as
compared to simple extrapolation schemes using bond dimension. We test our
approach in a number of solvable models both in 1d and 2d. Subsequently, we
apply it to 1d XXZ spin-$\frac32$ and the Bose-Hubbard models in a massive
regime in the vicinity of BKT critical point. We then fit the scaling form of
the correlation length and extract the position of the critical point and
obtain results comparable or better than those of other state-of-the-art
numerical methods. Finally, we show how the algebraic part of the correlation
function asymptotics can be directly recovered from the scaling of the dominant
form factor within our approach. Our method provides the means for detailed
studies of phase diagrams of quantum models in 1d and, through the finite
correlation length scaling of projected entangled pair states, also in 2d.
