  The solar telescope connected to HARPS-N has been observing the Sun since the
summer of 2015. Such high-cadence, long-baseline data set is crucial for
understanding spurious radial-velocity signals induced by our Sun and by the
instrument. On the instrumental side, this data set allowed us to detect
sub-\ms\,systematics that needed to be corrected for. The goal of this
manuscript is to i) present a new data reduction software for HARPS-N, ii)
demonstrate the improvement brought by this new software on the first three
years of the HARPS-N solar data set, and iii) release all the obtained solar
products, from extracted spectra to precise radial velocities. To correct for
the instrumental systematics observed in the data reduced with the current
version of the HARPS-N data reduction software (DRS version 3.7), we adapted
the newly available ESPRESSO DRS (version 2.2.3) to HARPS-N and developed new
optimized recipes for the spectrograph. We then compared the first three years
of HARPS-N solar data reduced with the current and new DRS. The most
significant improvement brought by the new DRS is a strong decrease in the
day-to-day radial-velocity scatter, from 1.27 to 1.07\ms; this is thanks to a
more robust method to derive wavelength solutions, but also to the use of
calibrations closer in time. The newly derived solar radial-velocities are also
better correlated with the chromospheric activity level of the Sun on the
long-term, with a Pearson correlation coefficient of 0.93 compared to 0.77
before, which is expected from our understanding of stellar signals. Finally,
we also discuss how HARPS-N spectral ghosts contaminate the measurement of the
calcium activity index, and present an efficient technique to derive an index
free of instrumental systematics. This paper presents a new data reduction
software for HARPS-N, and demonstrates its improvements [...]
