Take the cushions outside on a sunny day.
Use a stiff brush to remove any mildew or mold on the surface. Scrape the brush bristles across the surface of the fabric. Musty smells often indicate that mildew is present, and brushing will remove the spores.
Use the brush attachment of a vacuum to go over both sides of the pillow. This will help remove any mildew that may be lingering in the pillow filling under the fabric surface.
Spray the pillow with a fungicide or germ-killing spray.
Leave the pillow to air out in direct sunlight for a full day. Sunlight kills both mold and mildew, and it will help eliminate the musty smell.
Spray the pillow with a fabric deodorizer and bring it back in the house. Replace the pillow on the furniture.