This is a very good inquire, but is not the right one. The correct query is “why is the sky sometimes blue, other times gray, or orange and, at night, black?”
There you go: a complete question. But it happens that the sky doesn’t change its color. The one who likes to change the sky’s look is the Sun.
The Sun, like most stars, thinks that it is the center of the universe, it likes to shine more than anyone and it is very sentimental. And, because it’s an excellent painter, it loves to color the sky with its light according to its feelings.
When it’s happy, everything it’s ok and the sky is clear and pretty, it pant it all with light blue. It’s great, because people get to look up to the sky and be marveled by it as the Sun stands out.
On a cloudy or rainy day, the Sun gets very sad because it doesn’t standout much, it has to stay behind it all and all the clouds decide to appear more than the Sun. Then, it paints the whole sky gray in order to show that it’s very sad.
Every day, before it goes rest on the other side of the world, it colors the entire sky yellow, sometimes orange and, when it’s really enjoying itself, it paints the sky with shades of pink. This is what they call making a triumphal exit, so that everybody may admire its masterpiece before it leaves. I think that the Sun does it to leave everybody asking for more.
At night, the sky turns into black because that’s the Sun’s way of saying “Look, I left to take a nap. The other stars may shine now. Tell the Moon to work it!” So, it stops painting and lets the rest of the gang party all over the sky.
So that’s why you should always take a good look at the sky whenever you think it’s beautiful. You should clap your hands on the sunset and draw a Sun in the ground when it’s a cloudy or rainy day to ask the Sun to pop out. You should appreciate the Moon and the other stars, but don’t avoid sleeping just waiting for the Sun. All of this things makes the Sun extremely happy and makes it always excel itself with the colors.