Yikes, well that terrarium is really small for a 4 year old RES. Even a 4" turtle should be in something like a 40 gallon tank. Also, small pebbles will kill your turtle if he eats them. That could also be part of his problem if he has any rocks stuck in his stomache. It may not be enough to fully block his digestive tract but enough to prevent him from getting enough nutrition.
I hate to say it (and I know you won't want to hear it) but from reading everything that you've posted now, it really sounds like your turtle and your friend's turtles have been struggling to barely survive. I definitely would not say they are thriving by any means. In order for a turtle to thrive, they really should be living in an environment as close to what they would truly thrive in in the wild. As I mentioned before, we are really obligated to provide them with the very best care that we possibly can (within our means), and the best way to do that is to mimic their natural habitat as closely as possible.
Your friend's turtles are no more thriving than a group of turtles would be if they were living in a filthy pit in some dirty landfill or sewage treatment facility. RES turtles are sometimes able to adapt to some harsh conditions much like humans can, but that doesn't mean they are happy. Animals will do their best to survive even when they are miserable. And that is what those turtles are doing, merely surviving. There are too many people who keep their pets in horribly sub-standard conditions and it's a crime (literally).
It sounds like you're trying to do much better for your turtle and that's good. But I think maybe the reason he got sick before was because the conditions still weren't correct. Also, baby turtles can be more delicate and can get sick more easily than older turtles. At the time, putting him in a setting where he was able to be out of the water more and able to dry out was the right thing to do if he wasn't able to do that in his old setup. But now that he's doing better again you really should try to get him back into a more natural setup.
I strongly recommend that you read all of the information in the following links and try to gradually introduce him into a more suitable environment. I think you will notice a big difference and a much happier turtle that eats and plays regularly every day...
http://www.redearslider.com/index_basic_care.html
http://www.redearslider.com/index_nutrition.html
http://www.redearslider.com/index_habitat.html
http://www.redearslider.com/index_water_quality.html
http://www.redearslider.com/index_lighting_basking.html
Good additional reading that I also recommend can be found here...
http://www.redearslider.com/index_basic_info.html
http://www.redearslider.com/index_health.html
I hope you like to read!

I know it may seem like an awful lot of information but turtles are not easy beginner pets at all. They require an awful lot of special care in order to healthy and happy. Once you have the setup just right, there's not a whole lot to keeping them except to feed them and change their water and clean their filter a couple of times a month. Then you can really enjoy a happy and healthy turtle!
