MacBook goes to sleep when I keep a bluetooth speaker on top of it

Solution 1:

The MacBook detects your lid being closed with a magnet. Speakers also have a magnet, thats how they work.

When you put your speaker on your Mac, it "thinks" the lid was being closed and goes to sleep.