During the day, in presence of sunlight, the plants use up the CO2 and release O2 in the process of photosynthesis. But during night, plants won’t perform photosynthesis so they are unable to use the CO2 and this further leads to increase in the proportion of CO2 in the air. During night the trees breathe in oxygen and release CO2. If one sleeps under the trees, the amount of increased CO2 in the air around will certainly affect the health. So it is inadvisable to sleep under trees during night.