There are a bunch of threads on this in this forum. Basically you use the YouTube preset in the Adobe Media Encoder. You can open your AE project directly inside AME or you may render to a production codec from AE and use that in AME. DO NOT use AE to render h.264 files that are for anything other than a quick preview.
Thanks Rick - You've confirmed some of my thoughts and added new ones. Very helpful.