We spend about half our sleeping time in stage 2. It can last up to 50 minutes during the first 90-minute sleep cycle, and less during subsequent cycles.
During this time the brain consolidates the information that has been collected during the waking hours. It makes connections you might not make otherwise. It also curates which memories to keep and which to delete.