This paper presents a comparative study of the lattice dynamics of three-dimensional layered MoS2 and two-dimensional single layer MoS2 based on the density functional theory. A comprehensive analysis of energetics and optimized structure parameters is performed using different methods. It is found that the van der Waals attraction between layers of three-dimensional (3D) layered MoS2 is weak but is essential to hold the layers together with the equilibrium interlayer spacing. Cohesive energy, phonon dispersion curves, and corresponding density of states and related properties, such as Born-effective charges, dielectric constants, Raman and infrared active modes are calculated for 3D layered as well as 2D single layer MoS2 using their optimized structures. These calculated values are compared with the experimental data to reveal interesting dimensionality effects. The absence of a weak interlayer interaction in 2D single layer MoS2 results in the softening of some of Raman active modes.