This paper reports on the observation of the sidereal large-scale anisotropy of cosmic rays using data collected by the ARGO-YBJ experiment over 5 years (2008$-$2012). This analysis extends previous work limited to the period from 2008 January to 2009 December,near the minimum of solar activity between cycles 23 and 24.With the new data sample the period of solar cycle 24 from near minimum to maximum is investigated. A new method is used to improve the energy reconstruction, allowing us to cover a much wider energy range, from 4 to 520 TeV. Below 100 TeV, the anisotropy is dominated by two wide regions, the so-called tail-in and loss-cone features. At higher energies, a dramatic change of the morphology is confirmed. The yearly time dependence of the anisotropy is investigated. Finally, no noticeable variation of cosmic-ray anisotropy with solar activity is observed for a median energy of 7 TeV.