Does he look bloated? Sounds like a swim bladder issue but it could be something else. One of mine had this problem not too long ago and it got much worse before it got better. If he does seem bloated then you could try the pea method or fasting. Mine had problems getting to the surface and and getting back down so I put I'm in a hang-on breeding net so he could be close to the top. He didn't eat through his whole ordeal, not even the peas, so I guess in his case fasting worked. You can try these even if he isn't bloated since it won't always cause bloating. It could be impacted food/waste or that he got some air in the wrong place while eating. I hope he gets better!