Two problems with the above suggestions:
1. I can't predict when the monitor will stop working and so I can't reliably test it with a different computer (because I won't actually know if the problem persists on that computer unless I happen to be (un)lucky enough for it to happen again). I suppose I could try plugging in another monitor into this computer when it happens. If I'm able to, I'll try that next time.
2. I've tried turning the monitor off and on again. I've tried unplugging the monitor and then plugging it back in. Neither of these has any effect.
By the way, I didn't mention this but I *think* my keyboard still works when this happens (though I'm not confident about this) because the lights are still on. I don't know if there's any way to test whether my keyboard or mouse are functioning, though.