A loose chain will ruin your ride at best and pose a safety issue at worst. If your bike chain keeps loosening up, you need to find the cause of the problem and address it before riding again. The cause may differ from bike to bike because the mechanics vary.
If you have a fixed-gear bike, meaning one that you do not use a shifter on, the likely culprit is the nuts holding your rear axle. When these nuts become loose, the wheel can slide forward, shortening the distance between your pedals and your wheel. This causes a loose chain that is prone to falling off. Loosen the axle nuts further and slide the wheel into its proper place. Then tighten the nuts.
If you have a bike with a gearing system, the root of your loose chain problem may be a derailleur that is out of adjustment. Your front and rear derailleurs push your chain sideways so it will move onto the different sprockets on your bike, which is how the bike shifts from gear to gear. Check the derailleur's limit stops, which are the two screws that limit how far your derailleur can move from left to right and make sure that they're in alignment.
Derailleur damage also can cause chain problems. The rear derailleur is the most exposed and fragile part on your bike. It may become bent inward toward your spokes if hit. The portion of the derailleur that is most likely to become bent is the tab of the frame dropout that your derailleur attaches to. Look at your derailleur from the rear to determine if it is bent. Its two pulleys need to line up perfectly underneath one another. That ensures the chain runs straight up from your bike's tension pulley to its jockey pulley. Compare the pulley line with that of the sprockets above them to make sure there's no sideways slant. If this is your problem you need to remove the derailleur and straighten it. Don't try to yank it back into place because this may cause further damage.
If your sprockets or your chain are new, you need to check your chain length. New chains frequently come in lengths that are longer than they need to be. When your chain is too long it will be slack in your small-gear combinations. Your chain might simply be too old or can stretch over time. When this occurs you need to replace it. Consider that your loose chain also may be due to operator error. Exceeding the recommended gear range for the rear derailleur on your bike may lead to a droopy chain when you ride in these gears.