Check the mic hole. If there's lint and/or dirt in it, use a hand vacuum cleaner (DO NOT use a house vacuum cleaner - it can suck the mic right out of the phone) or the pointed end of a wooden toothpick to remove it.
If not, you probably need a new mic or a new earphone jack (the mic wiring goes through the jack).