During the day, molecular levels, neuronal activities and/or responsivity are tuned to our usual behavior, wake, which includes locomotor activity, eating, conscious interactions with our environment/people. During the night, these parameters are tuned to the usual behavior of sleep. So, if we are awake at these times, neurophysiology is prone to foster behavioral dysregulation, especially when these time-of-day effects are combined with sleep loss or disruption.
Heightened negative affect and diminished positive affect produce a narrowed attentional focus on neutral or negative stimuli which are assigned incorrect or excessive emotional salience by an overactive amygdala. This biased information then feeds into an aberrant reward/motivation system characterized by elevated dopamine levels, altered dopamine receptor availability, increased activity in the nucleus accumbens (ventral striatum), and reduced activity in the caudate and putamen (dorsal striatum), which results in diminished activity during reward receipt but maximized anticipation/expectation of reward, particularly for risky behaviors.
If you really want to get into the nitty-gritty of this then here's the science stuff and a hypothesis called 'The Midnight Mind' - as is clear from the bit I copied and pasted above, it can get a bit involved - but makes for an interesting read. Particularly for a recovering insomniac like me. :o)
https://www.frontiersin.org/articles/10.3389/fnetp.2021.830338/full