He looks stressed. When you say the parameters are ok, what does that mean exactly for ammonia, nitrite, nitrate, PH? How large is your tank? I assume you have a decent filter?
It's not unusual for bettas to spend a lot of time at the top, but I suppose if his behavior changed dramatically...