Phase retrieval (PR) is an ill-conditioned inverse problem which can be found in various science and engineering applications. Assuming sparse priority over the signal of interest, recent algorithms have been developed to solve the phase retrieval problem. Some examples include SparseAltMinPhase (SAMP), Sparse Wirtinger flow (SWF) and Sparse Truncated Amplitude flow (SPARTA). However, the optimization cost functions of the mentioned algorithms are nonconvex and non-smooth. In order to fix the non-smoothness of the cost function, the SPARTA method uses truncation thresholds to calculate a truncated step update direction. In practice, the truncation procedure requires calculating more parameters to obtain a desired performance in the phase recovery. Therefore, this paper proposes an algorithm called SPRSF (Sparse Phase retrieval via Smoothing Function) to solve the sparse PR problem by introducing a smoothing function. SPRSF is an iterative algorithm where the update step is obtained by a hard thresholding over a gradient descent direction. Theoretical analyses show that the smoothing function uniformly approximates the non-convex and non-smooth sparse PR optimization problem. Moreover, SPRSF does not require the truncation procedure used in SPARTA. Numerical tests demonstrate that SPRSF performs better than state-of-the-art methods, especially when there is no knowledge about the sparsity k. In particular, SPRSF attains a higher mean recovery rate in comparison with SPARTA, SAMP and SWF methods, when the sparsity varies for the real and complex cases. Further, in terms of the sampling complexity, the SPRSF method outperforms its competitive alternatives.