  Cooling simulations of neutron stars (NSs) are performed assuming that
stellar cores consist of neutrons, protons and electrons and using realistic
density profiles of superfluid critical temperatures $T_{cn}(\rho)$ and
$T_{cp}(\rho)$ of neutrons and protons. Taking a suitable profile of
$T_{cp}(\rho)$ with maximum $\sim 5 \times 10^9$ K one can obtain smooth
transition from slow to rapid cooling with increasing stellar mass. Adopting
the same profile one can explain the majority of observations of thermal
emission from isolated middle--aged NSs by cooling of NSs with different masses
either with no neutron superfluidity in the cores or with a weak superfluidity,
$T_{cn} < 10^8$ K. The required masses range from $\sim 1.2 M_\odot$ for (young
and hot) RX J0822-43 and (old and warm) PSR 1055-52 and RX J1856-3754 to
$\approx 1.45 M_\odot$ for the (colder) Geminga and Vela pulsars. Observations
constrain the $T_{cn}(\rho)$ and $T_{cp}(\rho)$ profiles with respect to the
threshold density of direct Urca process and maximum central density of NSs.
