When to add fresh basil to a tomato sauce?
Fresh herbs should, generally, be added closer to the end of a recipe. Dried herbs should be added fairly early on during the cooking process so that they have time to "develop" and more fully release their flavors. Fresh herbs and spices, however, will generally have more subtle flavors, and they are usually best used for seasoning at the very end of the recipe, rather than actual cooking. You can check out more details about how to use different kinds of spices in this article.

For your specific case, I would say to definitely add the basil in at the end—maybe five or ten minutes before the sauce is finished, as you said. It may even be a good idea to remove the pot from your heat source after you have added the basil so that the herbs can infuse their flavor without actually cooking into the sauce. You have to be careful not to cook too much of the flavor out with fresh herbs. If they simmer too long with the rest of the dish the subtle flavors can be easily overpowered by other ingredients.