The light staying on wouldn't have caused this. It's more likely he aspirated his water. Accidents happen sometimes.
Can you go over your husbandry with us just so we can make sure it's up to par?
What UV bulb do you use?
What is your basking surface temperature? And how do you measure your temperatures?
What does his daily diet look like? Please include quantities.
A picture of him and of his tank would help.
Unfortunately, trouble breathing and bubbles in the mouth is a sign of, at the least, respiratory distress. Usually it's indicative of an upper respiratory infection. If that's the case, he will definitely need to see a vet for treatment. Usually antibiotics to help clear the infection.
If you hold him gently and angle his head and body downwards, are you able to get any fluid to drain? Don't flip him over onto his back, he won't be able to breath, just angle him downwards.
Keeping him warmer overnight will help him. If you have a CHE , try to keep him at around 80 overnight. This keeps the immune system more active and the heat will help to dry the lungs.
-Brandon