Your run numbers are pretty good for those relatively short distances, but how long can you run. I'm not fast, but I can run for two hours straight without much problem.
If your legs won't keep going, it sounds to me you just need to work on your endurance. Slow down. Learn to ride longer. Once you build up your mileage, then you can worry about getting fast.
You can be the fastest person in the world, but if you can't complete the race distance then it doesn't matter.