Stretching afterwards is the key. I'm 40 also.
I'm starting to think that hard court tennis is worse on the body than I initially thought. I switched from basketball to tennis as my regular sport about 6 or 7 years ago. I always hit around during summers but I started full time at that point.
I basically stopped with the hoops due to rolled ankles, jammed thumbs, and the fear of getting teeth knocked out by elbow throwing butchers.
Over the last year or 2 I've had hip issues, a brief achilles issue, and more recently some elbow problems. If I don't stretch and/or take ibuprofen after a match, I'm walking like an 80 year old the next morning until blood starts flowing.
I haven't played a heavy afternoon of half court basketball in years. This weekend I played hoops pretty intensely for about 2 and a half hours.
The next day I really felt much better than I do after a tennis match, especially in the hips. There is a lot of unnatural torque on the body in tennis strokes, especially on gritty hard courts where your feet get locked to the ground, and also with modern windshield wiper forehands.
3.5 player. Equipment: Prince Original Graphite OS, Tourna Big Hitter Blue