Temazepam is used to treat insomnia (trouble with sleeping). This medicine is for short-term (usually 7 to 10 days) use only.