Since the sun is the source of all incoming energy for the Earth, it will not be surprising to know that variations in sunlight drive changes in climate on both short and long time scales. Of course the most obvious change is the cycle of seasons, which is driven by changes in the tilt of the Earth’s poles with respect to the sun. [Note that seasons are NOT driven by changes in the distance from the Earth to the sun, since the Earth is actually a little closer to the sun in January than in July.]
On very long time scales, long-term changes in Earth’s orbit around the sun are known to drive the wax and wane of the Ice Ages. These variations are called the Milankovitch cycles and reflect a variety of changes in the Earth’s orbit at time scales of about 20,000 to 100,000 years. Wikipedia has a nice article describing them here.
On intermediate time scales, variations in solar radiation may play a role, both directly by changes in the sunlight being emitted to Earth and indirectly by volcanic particles which block some of the sunlight before it hits the Earth’s surface. We know that a period called “The Little Ice Ages” (Wiki again) was a time of very cold temperatures that occurred at the same time as an apparent lack of sunspots, which has led many climatologists to believe that the sun was less active than usual and thus putting out less energy. The harsh winter of Valley Forge in the Revolutionary War occurred late in that period.
Volcanoes also keep sunlight from warming the Earth by producing tiny sulfuric acid droplets high in the atmosphere which reflect the light back to space before it can reach the surface. The droplets are like the shiny glass beads that make stop signs so reflective. (The sulfuric acid droplets are much more effective at blocking sunlight than volcanic ash, which falls near the Earth’s surface). When a big volcano erupts (the last big one was Mount Pinatubo in 1992), temperatures can cool for several years afterwards until the droplets fall out of the upper atmosphere. Smaller volcanoes can also provide an effect on climate if there are enough eruptions to keep the supply of aerosols high. Some scientists think that part of the warming that occurred during the 1930s in the Dust Bowl era was due to a lack of volcanic activity which made the upper atmosphere clearer than usual, allowing more sunlight to reach the Earth’s surface.
Recently, some skeptics have claimed that variations in sunlight are causing the recent warming of the globe. The Washington Post published an article in late February which discussed this and showed that the variations in solar activity do not correspond with changes in global temperature (see graph below). So while variations in sunlight have and do cause changes in climate on a variety of time scales, recent changes in sunlight cannot explain most of the changes we see in global temperatures in the last 100 years.