Sometimes I do, sometimes I don't. I honestly think that for people on the spectrum, it really serves as a very healthy and helpful tool for introspection. I think that it also may be very helpful in curbing loneliness (not that it should be used as a way to escape social engagement, but lets face it, people on the spectrum don't always feel less lonely from engaging others, even on meaningful levels).
When I am alone, my "imaginary" friend is usually myself. I literally visualize myself while I engage myself in in-depth conversation. I do this non-stop. It allows me to organize my thoughts, give names to feelings, logically sort out problems, or even just simple daily prioritization. My "alter-ego" will talk back to me, and together we figure out what's triggering anxiety, what's causing relationship strife, what we should do for dinner. It's completely natural to me and feels instinctual.
I also, almost as frequently as I talk to "myself," will rehearse social engagements in my head. If I have to make a phone call, I or my "alter-ego" will, in my mind, engage in the phone call and in this way I'll prepare in advance. I do this for almost ALL social engagement, and this too feels instinctual. The problem however comes when an engagement triggers anxiety, or it was an engagement that already happened and was negative. I will replay the past or future event over, and over, and over, sometimes changing my responses, sometimes changing their's, or sometimes just playing the exact same conversation (only as mentioned above, I'm taking an active role in it, not playing it like a movie) whether it actually happened or not.