I'm on day six of withdrawling from an opiate addiction and I haven't slept for the past three nights, why is that and how long will it be until I can?

Hyperarousal. Opiate withdrawal causes autonomic system hyperarousal. This includes increased heart rate, blood pressure, insomnia, etc. Sleep disturbance of some degree can continue for weeks. Not sleeping for several days, in addition to being uncomfortable, may lead to increased vulnerability to re-starting opiate use. If you are trying to stay away from opiates, help from a doctor will increase success.
Withdrawal. You are having withdrawal symptoms which are not addressed. Call you doctor.