One of interesting open questions for the high transition temperature (Tc) superconductivity in sulfur hydrides is why high pressure phases of H3S have extremely high Tc's. Recently, it has been pointed out that the presence of the van Hove singularities (vHs) around the Fermi level is crucial. However, while there have been quantitative estimates of Tc based on the Migdal-Eliashberg theory, the energy dependence of the density of states (DOS) has been neglected to simplify the Eliashberg equation. In this study, we go beyond the constant DOS approximation and explicitly consider the electronic structure over 40 eV around the Fermi level. In contrast with the previous conventional calculations, this approach with a sufficiently large number of Matsubara frequencies enables us to calculate Tc without introducing the empirical pseudo Coulomb potential. We show that while H3S has much higher Tc than H2S for which the vHs is absent, the constant DOS approximation employed so far seriously overestimates (underestimates) Tc by ∼ 60 K (∼ 10 K) for H3S (H2S). We then discuss the impact of the strong electron-phonon coupling on the electronic structure with and without the vHs and how it affects the superconductivity. Especially, we focus on (1) the feedback effect in the self-consistent calculation of the self-energy, (2) the effect of the energy shift due to the zero-point motion, and (3) the effect of the changes in the phonon frequencies due to strong anharmonicity. We show that the effect of (1)- (3) on Tc is about 10-30 K for both H3S and H2S. Eventually, Tc is estimated to be 181 K for H3S at 250 GPa and 34 K for H2S at 140 GPa, which explains the pressure dependence of Tc observed in the experiment. In addition, we evaluate the lowest order vertex correction beyond the Migdal-Eliashberg theory and discuss the validity of the Migdal approximation for sulfur hydrides.