The length of the day is dependent on the inclination of the Earth toward the sun and the observer's latitude. The angle of inclination, relative to the latitude, determines how high the sun rises in the sky, how large an arc it crosses and how long it's in the sky.
During summer in the Northern Hemisphere, the northern half of the Earth is inclined toward the sun and the southern half away from it. This inclination allows sunlight to fall at higher latitudes than it does at other times during the year, and it causes the sun to rise higher in the sky throughout the northern latitudes. With more of the sky to cover in a single day, the sun remains visible in the sky for a longer time between sunrise and sunset, increasing the length of the day.
After the summer solstice, at which point the sun rises as high in the sky as it ever does, and stays out longer than at any other time, Earth's inclination gradually shifts back toward a median point, called the equinox. This progression continues until the next solstice, six months after the preceding one, when the opposite hemisphere experiences its longest possible day.