It is a black handlebar mustache that is capable of flying.
Role in series
It is created by SpongeBob using the Magic Pencil. He adds it to Patrick's face because he requested it. Soon after, the mustache comes to life and flies away. It ends up on Squidward's head, who thinks it is hair. It later flies off Squidward's head when he falls while trying to pick up a fake dollar bill set up by SpongeBob and Patrick.
"The Slumber Party"
Somehow, SpongeBob possesses the mustache. He uses it for his pizza delivery sponge disguise to get into Pearl's slumber party, but it eventually flies away.