I recently experienced exactly this, with my Desire Z, although I wasn't able to exactly solve it. My suspicion was one of three things: a bug in the HTC android rom, a bug in the stock Music app, or a stuck power button. You didn't say if you were using the original HTC rom or whether you'd upgraded.
I actually upgraded my rom as an attempt to rule out the first of those (I followed an upgrade guide on xda-developers.com and upgraded to one of the unofficial Jelly Bean 4.2 roms), and I am happy to say that my phone no longer randomly reboots. But I can't identify the original problem because (1) my new rom is not a Sense rom and doesn't actually have the same Music app as the stock HTC Desire Z , so maybe actually it was a bug in the Music app after all, and (2) my power button is definitely stuck and causing all sorts of other problems. But at least not rebooting any more!