When milk boils, the cream rises to the top while the water in milk continues to boil beneath it. If the milk continues to boil, it will spill over. This occurs because milk is a colloid.
As a colloid, milk consists of several substances, including water, protein fat and sugar, that are in suspended form.
When milk begins to boil in a pot, the fat and the protein separate from the milk. This forms a cream film at the top of the pot. If one heats milk further, some of the water converts to water vapors below this film. The expansion of the water vapors causes foaming of the milk. This causes the cream layer to rise, leading to milk spilling out of the pot.
To avoid this problem of spillage, one can place a spoon with a long handle in the pot while the milk is boiling.