Make sure you brush your teeth and your tongue and floss, then use a mouthwash like Scope or Listerine afterwards.
If you haven’t been to your dentist in over 6 months, make an appointment immediately, there could be some trouble going on inside your mouth.
Eating onions and garlic can definitely cause problems, even if you have brushed and flossed, so if you have a regular problem with bad breath (after making sure that you have a clean bill of health inside your mouth) then you may have to cut out those foods, or just not eat them close to the time you’ll be going to bed. You can also chew a piece of sugarless gum, even after you’ve brushed and flossed and mouthwashed, right before you get into bed.
One way to tell if you have bad breath caused by your tongue (breathing into your hand won’t work) is to run a piece of dental floss across your tongue and give that a smell.
There are certain medical conditions (and the medications that are taken for them) that can cause bad breath too, especially meds and conditions that cause dry mouth. If you can’t solve the problem with proper oral hygiene and your dentist doesn’t see any problems with your teeth or tongue or gums, then you might have to make an appointment with your primary care physican to see what’s going on.