Under long-term horizontal cyclic loading, the evolution characteristics of the loading and unloading stiffness of piles are an important representation of pile–soil interaction. However, research in this area is limited, particularly regarding the impact of factors like pile–soil relative stiffness. In this study, laboratory tests with a long-term horizontal cyclic loading strategy were conducted to study various factors, including different cyclic amplitude ratios (ζb), cyclic load ratios (ζc), and pile–soil relative stiffness (T/L) in sandy soil, on dynamic pile head stiffness. The results show that the normalized cumulative displacement increases with the number of cycles and the ratio of T/L but tends to decrease as ζc increases. As ζb increases, the normalized cyclic loading stiffness also rises, while it has little effect on the normalized cyclic unloading stiffness. On the other hand, as ζc or T/L increases, the cyclic loading stiffness increases while the unloading stiffness decreases. Based on these observations, prediction formulas for normalized cumulative displacement and cyclic loading and unloading stiffness were established and confirmed with test results. The findings of this study provide methodological references for establishing models of pile–soil interaction under cyclic loading and for predicting loading and unloading stiffness under different influencing factors.