DoubleF overshares...
I used to have ridiculous sleep patterns to the point it was affecting things in regular life. The following things are thing that have stuck for me and seem to help.
Chemical things that conk me out leave me groggy the next morning. It means me at "actual awake" is later in the day and me actual tired is later is night. I avoid the booze, melatonin, sleeping pills etc. for this reason for regular, but they have their uses and I might use it on a weekend or something. It might help for one night, but could cause a chain reaction to mess up a bunch of other nights.
Don't take vitamin c just prior to sleeping. Vitamin c has properties that essentially give you the body exhausted but brain not turning off situation. Someone suggested to me to take B complex before bed. I don't know if it works... what's the worst than can happen other than nothing/placebo effect?
For caffeine, I know eating bananas helps to deal with caffeine shakes, but no idea if it aids quality of sleep. I've never needed to explore this one in depth.
Light pollution. Get rid of it. Phones, computers, misc indicator lights on clocks, black out blinds for street lights etc.
One thing I've been experimenting with, I'd describe as autopilot habit disruption. If you want to understand, swap the pocket your phone/wallet/keys are in and keep a rough estimate how many times you attempt to grab your phone but are at the wrong pocket. Even in the next few hours, you'll hit quite the number.
Taking the concept further, I now try to mix up the location of my phone when charging (usually like 2 feet from head beside bed). One big problem I had was alerts. I'd literally check to see if someone messaged me, email came in, news alert, game alert, alert about alert, worried I missed an alert... it was nearly automatic and kept me up. Misc variations in putting phone on floor vs bed table, across the room etc. help to discourage me from checking my phone as it's more inconvenient. Similar to how someone can constantly snooze and never realize it.
Quality of sleep that seemed to work great in the past and I've kept it up. There are many varied gentle waking apps and devices out there. They work for me. While I was single, sleep alarm has a motion detection attribute to the alarm that would allow me to be woken up more gently in the morning so I'm less groggy when I wake up (20-30 minute time window just prior to a time you set). If I am more chipper in the morning, it takes less time for me to "wake up" and thus I begin to "tire out" sooner at night and I am also less likely to consume excessive coffee to "wake up". However, said app doesn't work on memory foam or with a significant other in the bed. This lead me to look into certain activity trackers.
Such trackers use your movements at night to determine depth of sleep. Similar to above, it will wake you up closer to waking vs deep sleep. I don't think you even need a super spiffy one and some aren't much bigger than a bracelet and aren't cumbersome. They can even wake you with vibrations on the bracelet so that your SO isn't as disrupted by sound in the morning. I also want to experiment with one of those Phillips light alarm things, but they're damn expensive.
Naps. The sweet spot is 20 minutes. Any more and you get groggy.
https://sleep.org/articles/what-is-a-power-nap/