Kill the power and check for a loose connection on the switch. (and no just shutting off off the light does not count, kill the power at the breaker for that circut.
If that does not work.
Kill the power, change the switch, only undo one wire at a time. Make sure it's a three way switch that you buy.