Counseling can help you learn good sleep habits. You learn relaxation exercises and strategies for when you can't sleep, like getting up and doing something relaxing in a different room. Sleeping pills that are prescribed by a doctor can be a safe way to treat insomnia. Making a few changes to your sleep routine can improve minor sleep problems. Maintaining a regular sleep schedule, limiting bright lights, and establishing a calm pre-sleep ritual all help. You also should minimize daytime naps, exercise, avoid caffeine after lunch.