  The rare-earth peak in the $r$-process abundance pattern depends sensitively
on both the astrophysical conditions and subtle changes in nuclear structure in
the region. This work takes an important step elucidating the nuclear structure
and reducing the uncertainties in $r$-process calculations via precise atomic
mass measurements at the JYFLTRAP double Penning trap. $^{158}$Nd, $^{160}$Pm,
$^{162}$Sm, and $^{164-166}$Gd have been measured for the first time and the
precisions for $^{156}$Nd, $^{158}$Pm, $^{162,163}$Eu, $^{163}$Gd, and
$^{164}$Tb have been improved considerably. Nuclear structure has been probed
via two-neutron separation energies $S_{2n}$ and neutron pairing energy metrics
$D_n$. The data do not support the existence of a subshell closure at $N=100$.
Neutron pairing has been found to be weaker than predicted by theoretical mass
models. The impact on the calculated $r$-process abundances has been studied.
Substantial changes resulting in a smoother abundance distribution and a better
agreement with the solar $r$-process abundances are observed.
