In the times of sun set and sun rise the sun rays have to go many kelometre from the sun. So another rays(violet,blue,Indigo,green,yellow,) would scatter in space. The red ray has more wave length than the others. So it doesn't scatters.
So we see the sun set and rise in the color red