According to Rayleigh''s law, the intensity of scattered light varies inversely as the fourth power of its wavelength. Sunlight consists of seven colours. Of these, red has the maximum wavelength. During sunrise and sunset, the rays have to travel a larger part of the atmosphere because they are very close to the horizon.
Therefore, light other than red is mostly scattered away. Most of the red light, which is the least scattered, enters our eyes. Hence, the sun and the sky appear red.
In the morning and the in sunset, the sunlight has to travel more distance through the atmosphere of the earth for reaching us. So, as the sunlight is travelling more distance through the atmosphere of the earth, only the colours having high wavelength can reach us and colours having low wavelength are missing in the midway because they are scattered easily as the atmosphere of the earth contains air, moisture, smoke and other dust particles.