We present new observations of the center-to-limb variation of spectral lines in the quiet Sun. Our long-slit spectra are corrected for scattered light, which amounts to 4-8 % of the continuum intensity, by comparison with a Fourier transform spectrum of the disk center. We examine the effect of inelastic collisions with neutral hydrogen in NLTE line formation calculations of the oxygen infrared triplet, and the Na I 6160.8 A line. Adopting a classical one-dimensional theoretical model atmosphere, we find that the sodium transition, formed in higher layers, is much more effectively thermalized by hydrogen collisions than the high-excitation oxygen lines. This result appears as a simple consequence of the decrease of the ratio NH/Ne with depth in the solar photosphere. The center-to-limb variation of the selected lines is studied both under LTE and NLTE conditions. In the NLTE analysis, inelastic collisions with hydrogen atoms are considered with a simple approximation or neglected, in an attempt to test the validity of such approximation. For the sodium line studied, the best agreement between theory and observation happens when NLTE is considered and inelastic collisions with hydrogen are neglected in the rate equations. The analysis of the oxygen triplet benefits from a very detailed calculation using an LTE three-dimensional model atmosphere and NLTE line formation. The chi**2 statistics favors including hydrogen collisions with the approximation adopted, but the oxygen abundance derived in that case is significantly higher than the value derived from OH infrared transitions.