How are magnets held together, and why do they not explode?

The chemical bonds of the material keep it together.

If the magnets you're thinking of are made of metal, then the chemical bond is the metallic bond, which is quite strong. You can get a sense of how strong it is if you try to rip a metal bar into two. Unless you are exceptionally strong, you probably won't manage – but you are probably able to pull a bar magnet off a refrigerator door, for example. The force of the metallic bond is much larger than the magnetic force.

Ironically, the source of the metallic bond is also the electromagnetic force. For typical values, the electric force is much larger than the magnetic force. You can get a sense of this by examining the force between two spheres with charge $$1\ \mathrm C$$. If the two spheres are separated by a vacuum and are at a distance of $$1\ \mathrm m$$, the force between them is approximately $$9\times10^9\ \mathrm N$$. Meanwhile, if one of the spheres is moving at a speed of $$1\ \mathrm{m/s}$$ in Earth's magnetic field, the magnetic force it experiences is approximately $$3.2\times10^{-5}\ \mathrm N$$.

This large discrepancy is what keeps the magnet (and atoms) together.

Magnets are held together the same way all solids are held together: chemical bonds between the particles that make up the magnet, which are ultimately due to electromagnetism.

Take two fridge magnets that attract each other, stick them together, and pull them apart. Then take an ordinary piece of metal, and pull on its ends with about the same force. This produces roughly the same tensile stress that a fridge magnet is under constantly. Are you surprised that the metal doesn't come apart in your hands?