Certified GKH Gardening Expert
Basil can be tricky indoors. The most common reason for failure is simply not enough light. If your basil is leggy before it dies, this is a good sign it is not getting enough light. You can supplement the light with a florescent light placed near (like a few inches) the plant.
Other common reasons for basil dying indoors are fungus (brown spots on the leaves or fuzzy mold will indicate this), pests (small spots - sometimes fuzzy spots) and over and under watering (droopy leaves in both cases).