Burning the midnight oil
Before electric lighting, working late into the night required burning oil lamps. The phrase dates to the 17th century poet Francis Quarles who used it in his 1635 work "Emblemes." It simply means staying up late to work or study, a direct reference to the literal need for lamp oil during nighttime labor.