A friend says temperature increases as altitude increases because you're moving closer to the sun. Is this true? Explain.

I've been kinda stuck on this for a while... Please Help me out! :D