Maybe your cough just surfaces at night when you're trying to sleep. Or perhaps it's a nagging hack that sticks with you 24/7 after a nasty cold.

You're not alone. It seems like some coughs are impossible to shake. In fact, coughs are the No. 1 reason people go to the doctor, according to WebMD, accounting for more than 30 million visits every year. But how do you know when your cough is something to worry about or just something to wait out?

Figure out the cause

The key is first to determine why you're coughing. You reflexively cough to eject things that aren't supposed to be in your body. Some causes of cough include:

Viruses — Colds and the flu often include productive coughs that get rid of mucus in your lungs during the sickest part of your illness. But a dry cough can linger for weeks after the rest of your symptoms are gone.

Postnasal drip — When mucus drips down the back of your throat, that irritating feeling can trigger a cough. It can be caused by a cold, flu, allergies, sinus infections, some medicines and other problems.

Allergies and asthma — Triggers like pollen and mold can cause you to cough as your body tries to get them out of your system.

Acid reflux — Stomach acids can back up into your throat, causing irritation and a cough.

Pneumonia and bronchitis — More serious respiratory infections typically have cough as a primary symptom. The cough often lasts long after you start to feel better.

Other issues — Many other problems, such as medications, laryngitis and lung inflammation, can trigger a cough.

Does treatment help?

jar of honey There's scientific evidence that honey can be effective for soothing coughs and sore throats. (Photo: Vladimir Kovalchuk/Shutterstock)

Because coughs are so irritating, many of us reach for over-the-counter cough medicines to try to quiet them. But experts say that many of the "active" ingredients in these medications may be ineffective, reports Harvard Health, and major studies have been inclusive that cough medicines work.

That said, if cough medicine gives you relief, then use it. Choose from cough suppressants, which keep you from coughing, and expectorants, which help you cough up mucus.

Other options include natural cough remedies like honey, warm beverages, inhaling steam and sucking on cough drops. If your cough is allergy-related, try to avoid your triggers. Often, the most important thing you can do is be patient and give your cough time to go away.

When to see a doctor

man with thermometer and fever See your doctor if you have a cough and a fever. (Photo: Image Point Fr/Shutterstock)

Most coughs are annoying but harmless and will eventually go away on their own, says WebMD. But if you can't figure out the cause of your cough or if you have been coughing for several weeks with no improvement, it's time to call your doctor. The Mayo Clinic suggests seeing your doctor if you have any of the following symptoms:

  • Coughing up thick, greenish-yellow or blood-tinged phlegm
  • Wheezing
  • A fever higher than 100 F (38 C)
  • Shortness of breath or trouble breathing
  • Choking

Because there's a chance that a cough can be a sign of something more serious, your doctor can perform tests if he or she suspects there's something else going on. A chest X-ray, throat swab or blood test can all be used to diagnose infections or other issues, says Healthline.

But chances are that nagging hacking will eventually just go away on its own and you — and everyone in your house — will soon rest easy again.

Mary Jo DiLonardo writes about everything from health to parenting — and anything that helps explain why her dog does what he does.

When to worry about a lingering cough
You feel like you've been coughing forever, but when is it time to see a doctor?