I'd agree with OldEngr regarding when best to take the FE and PE but I think your question regards how they relate to higher degrees, specifically the MS and PhD. In short, they don't.
The FE (used to be EIT - engineer in training) is just a stepping stone to getting a PE (professional engineer) license. But you don't need a PE for the vast majority of engineering work. The PE is only for specific duties such as signing documents requiring a PE license, usually documents that are required by local government offices. If you work for a company designing products for example, you typically don't need a PE license. If you are selling 'engineering' services to the public however, it is likely you will need one. The vast majority of engineers I know work for a company, don't sell their services outside that company and therefore don't need and don't have a PE license. However, those companies will also typically have a handful of engineers with a PE license that can sign off on documentation especially with local government agencies such as permits that towns, cities and counties require.
An MS or PhD is simply a higher level of education. You don't need a PE license to get your MS or PhD and similarly, if you have an MS or PhD, you are not automatically granted a PE so you don't have the legal rights that a PE has. With an MS or PhD, you will still need to obtain a PE if you are going to do work in the public domain but just like a BS in engineering, you don't necessarily need one. If you are a student working towards an MS or PhD, you generally won't be able to obtain a PE license since a PE license requires that you first obtain an FE and then have a certain number of years experience working in an engineering position along side a PE before you are allowed to take the exam. Also, each state has their own requirements and a PE in one state does not allow you to act as a PE in another state.