Your first line of defense is a good pair of earplugs. The foam drugstore variety may be enough, but be aware that they're usually marketed as single use. Depending on how often you need them, it may be worth it to invest in a higher quality pair. Reusable earplugs are flexible, washable and in my experience, don't pop out as easily, so they'll stay in place through the 5 am garbage pickup.
The next step is to either block or drown out the offending noise. The key is to thicken the material between the noise and you. For windows, good curtains will help. Try bulky velvet or look for noise-absorbing drapes (usually with a thick wool core sandwiched between decorative fabric). If thin walls are the problem, fortifying them with a tapestry, bookshelf or even a layer of foam (if you can find a clever way to DIY) will bring down the decibels. A white noise machine or even a basic fan can do wonders to replace street noise with "your" noise, so it feels less violating.
When none of the above is enough to get you to sleep, it's time to go extreme. If you're sleepless enough to consider moving, then it might be worth consulting a contractor to re-frame or double-pane your windows (the most common culprit of noise leakage). Or, if your layout will tolerate it, consider swapping your bedroom with another room farther away from the noise. It might not be ideal during your waking hours, but finally getting good sleep will quickly make up for the inconvenience.
(Image: Michelle's Dream Space/Small Cool 2012)