Mixing energy shots and sleeping pills is not a good idea, just like mixing some vitamins with prescription medication or a combination of medications together is not a good idea. It's like telling your body you want to be awake, but you also want to be asleep.
However, if you are coming off of your energy shot, say 3-5 hours after taking, than you should be able to take the pill. This is because the energy drink is wearing off, and with some energy shots your body may feel tired, but your mind awake, and you will not be able to sleep even if you want to.
Remember we are not doctors, and suggest you talk to your medical provider in such a matter.
