"Better than to remain silent, and be THOUGHT a fool, than to open your mouth and remove all doubt."
This quote is often attributed to Lincoln, Twain and a shadowy fellow named Silvan Engel
More than likely they got their inspiration from Proverbs 17:28 (King James Bible):
Even a fool, when he holdeth his peace, is counted wise: and he that shutteth his lips is esteemed a man of understanding.