There are a couple of devises used in this line on both a small scale and on a large scale. First, there are two figures of speech (personification and metaphor) working together. In this speech of fatherly advice, spoken by Polonius, "Give thy thoughts no tongue nor any unproportioned thoughts his act," he is simply reminding Laertes to think before speaking and acting. Here, "thoughts" are personified into having a "tongue" and ability to act. The use of the word "tongue" is also a metaphor for speech. In other words, Polonius is saying, Don't always say what you are thinking and don't be too quick to act on your thoughts.
The bigger picture however, proves this quote to also be ironic. The very advice that Polonius gives his son just before Laertes leaves for school, is not put into practice by the old man himself. This could very well be one argument for why Polonius meets an untimely and early death.
Since Shakespeare has Polonius giving something non-living (thoughts) the quality of a human (tongue), the literary device is personification. Personification is the giving of human attributes to non-human things. Polonius is telling Laertes, in these lines, to keep his thoughts to himself rather than vocally share them with others.