The p-y curve method is currently the most widely utilized analytical approach for horizontally loaded piles. Precisely determining the ultimate soil resistance is essential to enhance the accuracy of the p-y curve. Despite various scholars proposing methods to establish the law governing ultimate soil resistance with soil depth in the sand, significant discrepancies exist among these approaches. This paper posits that the three-dimensional failure mode of the shallow soil in front of the pile manifests as a cone when it reaches the limit state. The expression for the ultimate soil resistance of a single pile in shallow soil is derived through limit equilibrium theory, and subsequently, the modified p-y curve is obtained. The accuracy was validated through a comparison between the corrected p-y curve and results obtained from centrifugation experiments and field studies. In contrast to the API specification method, the refined hyperbolic function p-y curve demonstrates enhanced precision, facilitating precise predictions of pile head displacement and pile bending moments under horizontal loads.