One of the best ways to keep seedlings from getting leggy is to pet or brush them with your hands.
Yes, you heard that right, we "pet" our seedlings to stimulate them to grow stockier and not get leggy. You can also use a small fan on them to keep them from getting leggy and spindly. Air circulation is important to keep seedlings healthy, and keep them from succumbing to dampening off, a common seedling ailment that causes them to shrivel and die. We grow a lot of pepper seeds and tomato seeds as well as other vegetable seeds, and we use this trick on all of them when we start the seeds indoors.