The short answer to this question is, it depends on who you ask. While some training plans take you up to 24 miles, others max. out at 16. While it’s rarely (if ever) recommended that you run the full 26 or more before your actual marathon, every plan includes a few high mileage runs. The reality is that you can probably gut your way through 26.2 miles even if you don’t get in all those runs, but it’s important to get your body ready for the stress of the race (without overtraining).
A major factor in deciding how many miles your long run should include is your running base. If you are a person who goes out and runs 15 miles for fun on the weekend, then your training plan might include more 20-mile runs than someone who is building up for their first marathon. Some coaches will insist on a specific formula for running a marathon, but many experts agree that it should be based on the runner - what’s your base mileage? What do you have time to do? What are your marathon goals? What’s your injury history?
You also have to consider how fast you recover. In the ideal world, you would have 4-6 days to recover per hour that you were running. Even if you don’t feel like you need that much, you’ll want to take it easy for at least a couple days after a long run. (That’s why most training plans take you up in mileage one week and then back down the next week.) If you find that you aren’t feeling as fresh for several days after your long run, you probably don’t want to push the distance any farther in your training.
If you aren’t sure how to manage your training or you aren’t sure if a training plan is for you, considering hiring a coach. Not only can a coach help you stay motivated, they can modify a training plan based on how you’re doing and feeling.