Outdoors the plant will be happy with the temperatures between 50 and 90 degrees. Anything above or below those temperatures will cause the plant to suffer and eventually die. Using a mulch will insulate the soil from the heat of the day and improve this situation greatly. To grow Sweet Basils, the daytime temperatures must be warm but not too hot (around 75-90 degrees) and it must get at least 3-4 hours of sunlight a day. It can be grown with filtered light all day such as under a tree or in a bright window indoors. If it gets too hot, dry or if it becomes pot bound the plant will begin its flowering process which signals the end of its life. It rarely produces more tasty leaves after the flowers appear.
It is important to keep the soil moist and somewhat cool and in a large pot, as well as pinching off the flowers that begin to form. The longest a basil plant will grow is about 6 months in the ground, about 3-4 months in a pot. Many people do not give the plant's roots enough room to grow and they become pot bound very quickly. This causes the plant to get too dry, too hot, and just plain cranky. It will eventually start to look yellow and the leaves will get smaller and the flower stalks will appear. At this point the plant will die and you probably cannot save it. You can however start a new plant and put it in a partly shady, cooler place in summer or indoors for the winter and still have great fresh basil.
Always cut basil by taking off the tops of the stems, about a third of the way down, to an intersection of new leaves. This will indicate to the plant to start growing the tiny new leaves into branches of more leaves. If you just pull of the leaf you want, you will get no new growth at all and your plant will start to stunt and begin making flowers. Once your plant starts this process of making flowers, if they are not trimmed off your plant will make seeds from the flowers and die soon after. So even if you are not making pesto, prune your plants regularly, store the leaves chopped up in a little olive oil in the refrigerator, and your plant will be healthier and happier.