Chemistry - Why does milk overflow when boiled?

Solution 1:

Milk contains surfactants (primarily lipids), which allow stable bubbles to form. In intense boiling, these bubbles can become mixed with liquid, supporting the liquid above them and forming what I'll call for want of a better term a "wet froth." Imagine a bunch of sponges made out of liquid. They take up more space than they would if you compressed them down and forced out the air. The inclusion of the water vapor in the bubbles lowers the density of the mixture, causing it to expand and overflow the pot.

The state is only stable because the added energy keeps creating new bubbles to replace any that have popped and keeps forcing liquid upward, while it would normally fall.

Water does not experience this mostly because its bubbles are far less stable. In fact, pure water does not form bubbles at all. The bubbles formed in water is typically due to impurities. If you were to add soap to a boiling pot of water, you would see the exact same effect, if not worse.

Solution 2:

Milk proteins denaturate in the heat and form a stable film on the surface of water bubbles. Bubbles on the surface burst in the beginning, and so the film becomes more and more stable there, stablilising the "foam" below.

The correct analogy is a pot of boiling water with pasta: As long as you leave the lid on, it will keep boiling over.