Washing your pillows in the washing machine can make them look like new again and not yellow. While we've advocated properly laundering your pillows before, this does not apply to foam pillows. Photo by bunnygoth.
Good Housekeeping explains that to clean foam pillows, you should instead vacuum them or tumble them in the dryer on the air-only cycle to remove dust. Spot-clean any soiled areas and let air dry. Also:
Some foam pillows include instructions for hand washing. If you choose to follow them, be very gentle. Wet foam is heavy and tears easily. To help pillows stay cleaner longer, use liners under your pillowcases and wash them monthly.
The above advice is contrary to some advice over at Deadspin, but it might depend on the type of foam pillow you have. When in doubt, just spot clean because foam pillows crumble apart pretty easily.
The Best Way to Clean Your Pillows [Good Housekeeping]