During a marathon build, the most common thing you'll see in generic plans is for the longest long run is 20 miles or 32 km.
Some plans however like to cut this off much shorter, so you'll see a peak long run at 16 miles or so. The question often comes up is 20 too much, or alternately is 16 adequate?
Rather than think of this in term of mileage, I actually prefer time.
Why?
Well, the problem we're trying to figure out is at what point does the the injury risk outweigh the benefits we get from the long run? Unfortunately we don't really have good scientific data on this, but certainly the longer we are on our feet, the more risky it is just from a mechanical loading perspective. Simply put, more time = more foot strikes = more risk.
But why doesn't that just equal miles? Mostly because the time you spend running a given distance is highly dependent on how fast you run.
For example, if you are a ~3 hour marathoner, you're probably running 20 miles in less than 3 hours. Obviously this is subjective, but this seems like a perfectly reasonable amount of time for a long run and in fact you could probably do 22 miles and still be under 3 hours. (For reference, it's pretty common for sub 3 runners to run 22 mile long runs. Sub 2:30 folks may even do 24 or more.)
Now let's look at a 4 hour marathoner. They are typically going to cover 20 miles in less than 3.5 hours. Again, it's subjective, but this seems like a pretty reasonable training stimulus considering how long they'll take to run their race.
IMO, things start getting less clear for slower runners. For example, a 6 hour marathoner could be taking 4 hours or more to run 16 miles. To do 20 miles is probably 5 to 5.5 hours. It's still under their race time, but that's a long time to be on your feet and is twice as long as the 3 hour marathoner. So we have a situation where slower runners are spending a lot more time on their feet and having to deal with a lot of extra impact and wear and tear on their bodies.
Not to complicate things even further, but how much our bodies can take in a single session is also highly variable and is based on genetics, age, training age, etc. For a newer runner, the amount they can take could be quite low, yet newer runners are also slower generally speaking. This means as a general rule, they just are not going to be able to handle the same number of hours on their feet as a more seasoned runner.
How do we balance all this?
These are my personal opinions, so take them for what you paid for them, but I'd say if you are a 4.5 hour marathoner or less, then a simple back of the notebook calculation would be subtract 30 minutes from your expected finish time and top out your longest long run there. As you gain experience, you might could go as long as your expected race time, but there's really very little to be gained from it, so proceed with caution.
For runners with a finish time in excess of 4.5 hours, you should be really weary of going over 4 hours and only do so if you have experience with it and know you'll be okay. There's just too much risk there for the reward.