They are a variety of different night lights that are hung on the wall of Barg'N-Mart labeled "Night Lights."
Role in episode
After SpongeBob reads a scary story, he becomes scared of the dark and cannot sleep. In the Krusty Krab, Mr. Krabs tells him to get a night light if he is scared of the dark. SpongeBob goes into Barg'N-Mart and buys one, but he is still scared, so he buys more so that his whole house is full of them.
Patrick notices the light in SpongeBob's house and mistakes it for a house party, so he comes on over to join in on the fun. However, SpongeBob informs him about the dangers of sleeping in the dark, which leads Patrick to refuse to go back under his rock and staying at his best friend's place.
Squidward's eyes get strained from the light shining through SpongeBob's house, so he tells the two that monsters are just a figment of their imagination, though they do not believe him. As a result, SpongeBob and Patrick end up bringing the entire lighthouse to the former's place so the brightness of the atmosphere reaches its capacity.
The light from the lighthouse displays an 'M' in the sky, so Mermaid Man and Barnacle Boy come. The light starts attracting The Moth, one of Mermaid Man's enemies whom he has been searching 57 years for, but SpongeBob stops him by trapping him in the lighthouse. As revenge, the Moth flies away with both the lighthouse and SpongeBob's pineapple.
This forces SpongeBob and Patrick to sleep through the creepy nature of outdoors, though they are then granted luck after the sun shortly rises.