Purpose: Theoretical study of gas density distribution around the planet given self-gravity. Methods: Proposed in this paper equations for the planet gaseous envelope density with corresponding boundary conditions are solved analytically and numerically by Runge-Kutta method. Results: For the first time, the analysis of numerical solution of equations for all the space where the planet gravitational influence prevails - in the distance range from the planet surface till Hill radius - has been pursued using similarity method. Near the planet, the solution coincides with classical barometric formula, at intermediary distances, - with barometric formula which takes into consideration the dependence of free fall acceleration from the distance till the planet, at large distances, - with the dependence of density for singular isothermal gas sphere due to self-gravity. Practical significance: On the basis of the solution obtained, the unified picture of the planet gaseous envelope density distribution was analyzed. The results presented in the paper can be useful both for university physics professors and for the researchers involved in astrophysics.