Basil and tomatoes are good companion plants and basil does help protect the tomatoes from pests. My basil went crazy this year in Texas. It's been so hot. In Oregon I never had much luck with it as the weather was cooler.
You can use
safer soap products to kill insects naturally in the garden. They make one for houseplants, veggies, roses, etc.
One thing you can do too is plant lots of flowers, like marigolds, in among veggies. They attract the good bugs, which eat the bad bugs.