Is it better to add fresh basil to a tomato sauce and then let it cook for say, 10 mins, or wait till the end and add just before serving?
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.
It depends on what are you doing. Usually, fresh basil has to be added to a fresh sauce (means a sauce made by fresh tomatoes, to serve it "today") just at the end of cooking, 3-4 minutes before you turn your fire off. Then let it rest some minutes more, while you cook the pasta. You have to light the fire again at end, because you need a very hot sauce over your very hot pasta. It is very nice to save some leaves aside (the two top leaves, or the lateral ones, btw), and then add the leaves on each dish to decorate.
If you are doing a sauce for canning your own tomato sauce, you have to add fresh basil before to mill the sauce.
If you are doing any sauce using canned tomatoes, probably time to add the basil is indifferent, since canned tomatoes are seasoned yet, normally at least with salt. Or other industrial stuffs. Maybe add the basil halfway through cooking helps to cover the industry flavors.
Basil is commonly used fresh in cooked recipes. In general, it is added at the last moment, as cooking quickly destroys the flavor.
Fresh sage and rosemary are herbs for roasted meat and never for tomato sauce. Oregano, fresh or dry (maybe dray), is herb for pizza, so if you cook something with oregano, it is called "alla pizzaiola".
With basil (and other soft, fresh herbs), wait till the end to add them, just before serving.