Without the sun, plants can't get the food they need to grow, reproduce and survive. Unlike animals, plants are autotrophs, meaning they create their own food source. They use energy from light or from the sun, water and gases from the air to create glucose. This process is photosynthesis and all plants, algae and even some microorganisms use it.
TL;DR (Too Long; Didn't Read)
The sun is the main source of energy for almost every living thing on Earth. It gives a plant the light energy it needs to photosynthesize, which converts that light energy into a storable form (glucose) and keeps plants alive. A by-product of photosynthesis is the oxygen all animals need to survive.
How Photosynthesis Works
A plant absorbs carbon dioxide from the air through tiny holes in its leaves, branches, stems, flowers and roots, water from the soil through its roots and light energy from the sun to perform photosynthesis. Light energy triggers a chemical reaction, breaking down carbon dioxide and water molecules and rearranging them to create sugar (glucose) and oxygen gas. Sugar is then broken down by the hardworking organelles called chloroplasts, which are most abundant in the cells of the plant's green leaves, into energy to fuel the plant's growth and repair. The oxygen gas produced by the plant goes back into the atmosphere via the same little holes that absorbed the carbon dioxide.
The Photosynthetic Process
Photosynthesis is a complex process with two stages. The first stage is a light-dependent reaction when photons from sunlight hit the plant's leaf, galvanize the light-absorbing pigment chlorophyll and activate electrons. This divides water into oxygen and hydrogen ions. The second stage, a light-independent reaction, uses the energy from the light reaction to convert carbon dioxide into glucose through a series of chemical reactions that begin with 3-ribulose bisphosphate and end up with the same molecule, producing glucose in the process. The plant uses glucose in different ways. It can convert it into chemicals needed to grow plant cells like cellulose or starch that it can store until the plant needs to convert it back to glucose. It can break it down during respiration, releasing energy stored in the glucose molecules. A plant doesn't need energy from the sun for respiration.
If a plant doesn't get enough light from the sun, the photosynthetic process slows down, even if it has sufficient water and carbon dioxide. Increasing the light intensity will boost the speed of photosynthesis. Likewise, if a plant doesn't get enough carbon dioxide, this limits the photosynthetic process even if it gets plenty of light. Sometimes, farmers use artificial lights to let plants photosynthesize beyond daylight hours.