This paper proposes an effective density correction method to improve the accuracy and reliability of smoothed particle hydrodynamics (SPH) simulations. The density field calculated in the SPH procedure is automatically corrected by a new density interpolation adopting shape functions, which is individually applied to each particle. The proposed method makes the density field smoother, effectively reducing unphysical oscillations and peaks in density and pressure, with small additional computations. Unlike previous methods, the new density correction method does not result in flattened solutions, even when used too frequently or for a long time. The proposed method can be easily applied to both 2D and 3D flow analysis. The performance of the proposed method is demonstrated through various numerical examples including violent free surface flows. In particular, comparisons with the Shepard interpolation, the MLS interpolation, and 6-SPH are studied.