Basil grows best outdoors where it can receive adequate light and temperatures, but you can also grow basil indoors as long as it's set in a sunny location. Whether you plant basil indoors as a natural fly deterrent --- flies can't stand the scent of basil --- or grow the plant for use in your recipes, don't give up on a dying basil plant; try caring for the plant as normal to revive it.
Repot the plant to ensure that it is in well-draining soil. Replace the plant in a well-draining potting mix. Choose a pot with drainage holes to ensure that the water doesn't accumulate and expose the roots to too much water.
Sterilise scissor blades with isopropyl alcohol and remove dead or damaged leaves from the plant. Eliminating dead parts encourages energy to go to the undamaged parts of the plant.
Water the soil around the plant until the top 25mm (1 inch) of soil is wet, but not saturated. Don't let the leaves themselves get wet. Pour off excess water from the soil surface as necessary. Allow the soil to dry out before watering it again, but keep it near other plants to increase humidity, or mist the plant with water between waterings.
Set the plant in a south-facing window that receives six to eight hours of direct sunlight each day. Turn the plant every day to ensure that all parts of the plant receive adequate direct sunlight.
Apply high nitrogen fertiliser -- diluted to half strength -- every four to six weeks to the potting soil.
Don't harvest basil for your recipes until it has two to three sets of healthy leaves. Clip just above the pair of leaves to harvest the whole stem.
According to the Alabama Cooperative Extension Service, basil only looks attractive in a container for about a year. If your basil is more than one year old, consider replacing it.
If using potted basil for recipes, don't let the plant grow flowers or form seed; the plant will stop growing and become bitter.