This article is a part of CNN Underscored’s Guide to Sleep, a weeklong focus on everything you need to sleep better. We’ll be featuring new products and exclusive deals all week, so check in every morning to see what’s new and be sure to subscribe to the CNN Underscored newsletter to see it all.

Cleaning your bed pillows serves two important purposes. The first is to rid the pillow of buildup that naturally occurs while you sleep — drool, sweat, bacteria, dust mites, dust, dirt and oils from your skin will soil your pillow, as will pet hair and dander if you have a pet that sleeps in the bed with you.

Cleaning a pillow also helps to maintain its comfort by restoring loft and fluffiness and by freshening it up. Sleeping on an unclean pillow is not only unpleasant, but it can also exacerbate asthma and allergy symptoms in those who suffer.

We spoke with experts about how and how often to wash your bed pillows, and when they need to be replaced outright.

How often should you wash your pillow?

Logan Foley, the managing editor of sleepfoundation.org, says, “You should wash your pillow at least twice a year. If you sweat a lot when you sleep or if you sleep with pets, you should wash them more frequently.”

Pillows that are used less frequently, like those in a guest room, don’t need to be washed as often. To determine if a pillow needs to be washed, Susan Lazor, an associate product merchant at The Company Store, says, “The first indicators that your pillows require immediate care include yellowing, or smelling a slightly sour or musty odor.” Additionally, if the pillows are no longer as fluffy or as comfortable as they were when new, washing can help to refresh and revive them.

“Pillows can gather dust mites, fungus, bacteria, sweat and body oils” that Foley says cleaning will eliminate, helping to prevent ill health effects. “Everyone should clean their pillow, but this is especially important for people who struggle with allergies,” she says.

How to wash synthetic fiber and down alternative pillows

Synthetic fiber and down alternative pillows can be machine-washed and -dried at home, following these steps provided by Lindsay Jones, a product brand manager at Maytag.

Tide Free & Gentle Liquid Laundry Detergent

$12.97 at Amazon

Tide Free & Gentle Liquid Laundry Detergent
  • Prior to washing, remove pillowcases and coverings like pillow protectors.
  • Wash two pillows in a single load to balance the washer.
  • Use only a tablespoon of detergent to prevent over-sudsing and detergent buildup inside the pillow.
  • Use the washer’s gentle cycle and the warmest water temperature recommended on the pillow’s care tag.
  • If your washer has it, select the extra rinse cycle, which helps to flush excess detergent out of thicker, bulkier items like pillows.

S&T Inc. Reusable Laundry Dryer Balls, 6-Pack

$9.99 at Amazon

S&T Inc. Reusable Laundry Dryer Balls, 6-Pack
  • Once the wash is complete, transfer pillows to the dryer right away.
  • Use dryer balls to help fluff the pillows and redistribute filling while drying.
  • Select a low-heat setting when drying pillows with synthetic filling.
  • Make sure pillows are completely dry before coming out of the dryer, as residual dampness can cause mildew growth in pillows.

How to wash feather and down pillows

Lazor says that most feather- and down-filled pillows can also be washed and dried in the machine, using the same instructions as for synthetic-fill pillows. To protect the feathers, opt for the no-heat or air-fluff dryer setting.

However, if you’re hesitant about washing feather and down pillows at home, or if the care instructions recommend it, Lazor says, “Take a trip to the dry cleaners. Most offer specialized pillow cleaning services.”

How to wash memory foam, latex and gel pillows

When it comes to cleaning pillows with a more structured fill, machine-washing is unfortunately not an option. “Firm support, memory foam, gel and latex pillows should be cared for by hand, as they can neither be machine-washed nor dried,” Lazor says.

Dawn Ultra Pure Essentials Dishwashing Liquid

$8 at Amazon

Dawn Ultra Pure Essentials Dishwashing Liquid

To care for these pillows, Lazor recommends spot cleaning with a mild dish soap every two to three months, allowing them to air-dry completely before putting cases back on and replacing them on the bed.

Vamako Folding Laundry Washing Basin With Draining Plug

$19.99 $16.99 at Amazon

Vamako Folding Laundry Washing Basin With Draining Plug

For a deeper clean, Jones says to take these steps:

  • Remove pillowcases and other coverings.
  • Fill a bucket, bathtub or sink with a mixture of lukewarm water and a tablespoon of detergent; the water should be deep enough to completely submerge the pillow.
  • While submerged, gently massage the pillow to circulate the solution through it.
  • Lift the pillow out of the bucket and squeeze out the soapy water; repeat this step two to three times.
  • Rinse with clean water, squeezing gently until the water runs clear.
  • Place the pillow between two towels and press down to squeeze out more water.
  • Hang or lay the pillow flat to air-dry, ideally in the sun.

While deep cleaning a firm-fill pillow can be a bit of a chore, it won’t be one you have to do often. “Memory foam has hypoallergenic properties that make it less susceptible to mildew, allergens and dust mites,” Jones says, “so you may not need to deep clean it every time.”

Jones adds that giving a memory foam pillow a quick refresh is as simple as running a vacuum. “You can sprinkle some baking soda on both sides, let it sit for one hour, then vacuum it off,” she says. “This will help neutralize odors while sucking up dust mites and dirt.”

When to replace a pillow

At some point, even with the best of care, a pillow will need to be replaced outright. “Generally speaking, pillows should be replaced every two years,” Foley says. If your pillow is ready to be replaced, check out our guide to the best pillows for every type of sleeper.

However, Foley says that regularly cleaning pillows will help to extend their life span, saving you money and, more importantly, sparing you the dreaded breaking in of a new pillow! “Some pillows can last longer than that, up to five years, with proper care.”