There are so many factors that could be involved, so I'll just mention one with which I have personal experience.
Cardio fitness helps me to keep it harder longer. A few years ago, I raised the bar with running and cycling. My return to a higher level of fitness made my erections harder, last longer, and now it's very rare that I go limp during sex. 5 years ago, I'd only get off half of the times that I had sex, and it was a struggle. Now I bust a nut every time, and it's usually very intense - just like when I was 25.
If you don't get regular hard cardio workouts, get involved with some heart pumping recreation. Jogging/running is the best thing for getting a lot of intensity in a short amount of time. Cycling, rollerblading, or brisk walking will do it, too.