Answer by Joshua Engel:
Nothing you do is actually getting you closer to the sun. The highest point on earth is only a few miles up. The Space Station is about 200 miles up. Even the Moon is only 250,000 miles away. The sun is 93 *million* miles away. None of that gets you significantly closer to the sun.
But you are moving significantly further from the earth's surface and atmosphere. The earth earth is warm for a a variety of reasons, including its internal heat of formation (the energy of all of the rocks that make up the earth falling together under their mutual gravitational attraction), the heat of radioactive elements decaying, and the sun itself warming the earth. The planet (water, rocks, even air) holds onto that heat, as so it's considerably warmer than empty space.
When you move away from the earth, you move away from that heat. If you could move millions of miles towards the sun it will begin to get warmer again, though it's a very uncomfortable kind of warmth where your face is burning and your butt is freezing. The atmosphere on earth helps distribute the heat all around you in a comfortable way. It also helps retain the heat when the sun sets: on the moon, the temperature drops 600 degrees F (350C) at sunset.
Note that the high temperature on the moon is actually far higher than on earth, where the atmosphere distributes the heat. Talking about temperature is very different when you don't have an atmosphere. Astronauts in space have to wear space suits that keep the temperature even on their bodies.
Anyway, tl;dr: it gets colder when you go up because you have less planet and less atmosphere near you, but you're not getting enough closer to the sun to make a difference. That would require a much, much longer and more uncomfortable trip.