OMG, I have the exact same problem and it feels the same way. Absolutely horrible, and once you start scratching, you'll tear yourself to pieces because of the relief. I've had this on and off for years. The first time it happened, I too thought it was pinworms. I did a daily compress of boric acid diluted in water. Everytime I went to the bathroom, after cleaning, I would apply this boric acid compress and after a few days, the itch went away. Not only that, but my skin returned to normal (I had been doing such damage, my skin looked and felt like elephant skin around the anus).
However, now, after years of nothing, it's back with a vengeance. It's not only around the anus, but it's started spreading to the perineum and vulva. I had a biopsy done, as intense itching in this area could be signs of something much more serious, such as lichen sclerosis or, worse, vulva cancer. Turns it, is friggin eczema (which is a generic term for inflamed, itchy skin). Thanks alot.
I'm glad it's not something more serious, but OMG this is horrible. I was just prescribed 30 days of Lidex ointment as a treatment, apparently there is no cure. However, I agree with one of the other commentators to stay away from long term use of cortisones, and try whatever you can do to not scratch. I know apple cider vinegar is supposed to be a good natural remedy for skin inflammation and itching. I was using an apple cider vinegar compress (diluted of course) before the biopsy, and it gave some temporary relief, you may want to try it before bedtime.
Sorry you are going thru this, but man, I know what you're feeling.