ETA: Indeed, 4 USC 6(a) [1]:
It is the universal custom to display the flag only from sunrise to sunset on buildings and on stationary flagstaffs in the open. However, when a patriotic effect is desired, the flag may be displayed 24 hours a day if properly illuminated during the hours of darkness.
To the best of my understanding, no criminal penalty attaches to mishandling a flag in contravention of Title 4 requirements, despite the occasional misguided attempt to prosecute someone who, for example, incinerates a symbol of his nation in order to attempt some sort of point about the present conduct of its government. That said, it would surprise me to learn that anyone who flies the flag for patriotic reasons would disregard a legal recommendation regarding the proper manner of such display.