The effects of uncertainties in the structure of the superficial layers of the Sun, such as the helium abundance, opacity and equation of state, on the p-mode frequencies are considered in terms of the phase function. The analysis is carried out by means of a linear relation between phase-function differences and equilibrium structure differences, investigating separately the influence of different layers on the phase-function differences. We develop a method which allows information of this nature to be extracted from analysis of p-mode frequencies. By using a filtering technique, the effects of the uncertain uppermost layers of the Sun can be eliminated in the analysis. The procedure is applied to a comparison of observed and computed frequencies. Our main results concern the helium ionization zones: in particular, we find that the analysis allows us to distinguish between different equations of state of partially ionized gases. By using the equation of state that best fits the data, we estimate that the solar envelope helium abundance by mass is Ys = 0.242+0.003. The error is obtained by considering models differing in other parameters and applying different filters, but uncertainties in the equation of state can introduce larger errors. Key words: methods: data analysis - Sun: interior - Sun: oscillations - stars: oscillations.