You may be thinking of Polonius' advice to his son Laertes in Hamlet. In act I, scene III, Polonius offers some last minute pointers to Laertes before he leaves to sail. In the midst of Polonius' long blessing, he offers this advice:
"Take each man’s censure but reserve thy judgment.Costly thy habit as thy purse can buy,But not expressed in fancy—rich, not gaudy,For the apparel oft proclaims the man" (I.III.69-72).
Give thy thoughts no tongue,Nor any unproportioned thought his act.