Bottom note box.
The origins of this idiom.
The meaning of this phrase.
Phrases and Idioms
knowyourphrase.com - The Meanings and History For Popular Idioms and Phrases
P
Asking someone to be quiet or to shut up.
The origins for this expression are unclear. It's not really known why a sock is being used, or what the 'it' in the phrase refers to. It might be a person's mouth, or it could be something else.

This phrase is occasionally directed at people who are being annoyingly loud. The imagery for this idiom is that someone is being so noisy, a sock is stuff into their mouths in order to quiet them down.

However, recordings of this expression show it began to pop up at least as early as 20th century, and it was already sporting the meaning it has today. For example, the Western Mail, printed in 1919, wrote the following:

"But if you want to see a racecourse — a real full-sized dinkum top-hole racecourse I'm speaking of,
mind you — come along with me to Tasmania,' chimed in the small voice of a lad who was very fond
of apples, 'and I will show you—

'Oh, dry up Tassie; put a sock in it.'"
* Will you put a sock in it already, I told you that I'd take the garbage out later when the temperature cools off.

* Jake had difficulty studying in the library because of the loud typing that was going on in the background, so he approached the noisy offenders and told them to place a sock in it.
Note: Finding the origins for many popular sayings can be very difficult much of the time, as it's hard to find the person or area where an idiom started. When the origin of a phrase are unclear, what you will see listed are the theories for how a phrase may have originated, but it might not necessarily be the case, so keep that in mind.

The quotes, being pulled from old books, poems, newspapers, etc., are there to help the reader recognise how old some sayings are. The quotes are some of the oldest I could find, but there is a possiblity that older citations exist and I missed. So if you'd like to inform me of an older written form of a phrase that dates back further than what I have, then feel free to contact me and let me know.
Know Your Phrase - A List of Popular Expressions And Common Idioms > P-Letter Sayings