The sun affects the weather by providing heat and light to the Earth. It plays a crucial role in the formation of weather patterns such as temperature, air pressure, and wind. The sun's energy drives the water cycle, causing evaporation, condensation, and precipitation, which are essential components of weather. Additionally, the sun's position in the sky affects the length of daylight and seasons, further influencing weather conditions.