I keep a script for Lunesta, and my ‘rule’ is that I use it on the third night after 2 bad nights. This keeps my body/mind from getting stuck in a pattern of insomnia, and also helps with the mental anxiety that comes with multiple bad nights.
I also am very careful to practice good sleep hygiene, which I know you said you do, too. Sometimes I feel myself getting a little sloppy and have to go back to being anal about it.
Insomnia sucks.