When should I take a muscle relaxer to help me sleep?

Rarely. A side effect of muscle relaxers is that they can make you tired and help you to sleep. It is better for your doctor to evaluate why you can't sleep and to treat the actual cause.