What kind of rat is he? A grey one or a pretty coloured one? Maybe call a pet shop and ask them that sell rats. It could be something simle like worms and that would be easily treated with worming stuff. Is he getting plenty of good food rich in vitamin C and the vitamins they need? It could be a vitamin deficency that can easily be treated. There are lots of group chat things for animals (similar to this one specific to rats) I would try finding one and asking other rat lovers as they may have some advise if this is quiet common in rats. I have no experience in rats only horses, cows, sheep, birds and guinea pigs. I would try rule out the obvious things like vitamins and worms etc. Also is he pooing as much as always? Make sure he isn't blocked up. Is he eating normally? Also how active is he? Rats dont go through puberty at 6months I am sure they would be much much younger then this as I know when they are sexually mature they can loose weight if they are running around alot etc. Good luck. I hope he gets better.
Bookmarks