Sounds like Swim Bladder; Some treatments from a previous post of mine.
1. Feed your fish a couple of peas. Just get some frozen peas, thaw them, and feed them to your fish. Peas somehow encourage destruction of the impaction. No hard scientific evidence, but it's worth a try. Bloodworms have also worked for me.
2. Fast your fish for a couple of days. Withhold all food for three or four days, and sometimes this alone will break up the impaction and return things to normal. Most fish can go a week to ten days without food and be just fine.
3. Periodic aspiration of the swim bladder works very well. Basically, you stick a needle in the swim bladder and suck out some of the air. Not something to be entered into lightly, but does work well. This is not a cure, but a successful treatment.
Some of these treatments seem a bit extreme but it is worth giving a couple of them a try. There is also a Partial pneumocystectomy. This is another word for surgical removal of part of the swim bladder. But this is for the Vetnary side of things so is probably out of the question unless you know a vet that has performed such a procedure. (Very rare, heard about it through a Goldfish breeder).
There are also various medicines availble at fish shops, depending on what your shop stocks. However, I have never had much success with these.
To reduce ammonia levels the best really is to do some regular partail water changes until the levels are what they should be and then set-up a regular schedule.