One thing that wasn't mentioned here is that harass tactics against the opponent's economy/base are very effective against an opponent with a heavy void ray composition. Void rays are most effective when sticking together as a large group, so players are reluctant to split them and therefore won't have as much capacity to defend their base and attack yours at the same time. If they can't attack you, you can gain an economic advantage. You'll need to be very fast at killing their probes, so dark templars are what I would recommend there (and you can morph them into archons after the opponent builds cannons).
Taking out the opponent's economy is extremely important in this situation, as the void rays have a synergy with themselves in large numbers.
When it comes to the actual fight, I can only comment from a Protoss perspective. You'll probably need high templars with storm. Forget massing blink stalkers alone, as they will be ripped to shreds by the prismatic alignment ability. You will need stalkers, but you won't be able to win by massing them.
You'll also need to be good about scouting if you want to win. If you see two starports, start getting high templars and storm ASAP so that you can save up enough energy for storm. After running out of energy, merge the templars into archons. Even if you don't see any void rays off of the two stargate, you may be going up against carriers, of which the interceptors are also vulnerable to storm.
Protoss units that are effective against Void Rays:
- High Templar with Storm
- Carriers (if you micro-retreat the ones that are focus fired, you can mitigate quite a bit of damage and win the fight)
As always, better micro will give you an edge. Be sure to not be at an upgrade disadvantage as well as you will likely lose if that happens.