Void rays?
The right counter depends on what point of the game you're in. Ideally, if he VR rushes you have warpgates. Warping in 4 stalkers right underneath 2 VRs is enough to beat them if you 4gated. If you went with a 2gate robo then you're going to have issues getting enough stalkers in to beat the Void Rays, but your best bet is constantly warping in new units. Usually you don't want your opponent to shoot at units warping in, but with Void Rays you want them to switch targets before their beams are charged. As a side note, using a single guardian shield with a sentry can make it tough for Void Rays to kill things before their beams charge up.
If your opponent commits to Void Rays and makes more than 4, then it becomes worth your while to invest in a twilight council and research blink. The idea is that stalkers in your base can always hold off mass Void Ray, but you're going to be contained until you find a way to actually kill them. Blink is the way to do that, but never jump the gun on the tech switch. If Void Rays were just a rush tactic and he falls back on Immortals or gateway units, your mass blink stalkers won't do so well against the right mix.
M+M+M?
Early game this can come in many forms, but usually your best bet is to take Immortals in to Colossi. You can also go Templar. The danger of opting for templar is that the push will come before you have storm, and it's very hard to defend against it. Likewise, the push will also probably come before your Colossi, but a few Immortals mixed with gateway units can deal with this composition. The idea is that you prevent them from kiting your zealots by using stalkers and you prevent the marauders from wiping your stalkers by having Immortals there. Forcefield range is a bit low to be used effectively in this situation so I'd skimp on the sentries and just use guardian shield to stop Marines from destroying your Immortals so easily.
One other good response to an early marauder push is to get two Void Rays and use them defensively. When the attack happens, push right in to their face with Zealots, Stalkes, a couple Sentries and your VRs. They will try to target fire the Void Rays down with their marines, but if they overinvested in Marauders your stalkers can take them out while your zealots distract the Marauders. After that point, Marauders can't touch Void Rays so they'll have to fall back, and if you have good macro you can pump units straight to his base and win the game right there. The reason this works is because on maps like steppes of war he can really only get 3 or 4 marines out of he went double tech lab for marauders, and when you arrive at his base, Void Rays can give ramp vision and charge up on their barracks while stalkers kill the marines he's forced to make instead of marauders. I used this as a staple response to mass marauders during the last few days of the beta and it did very well. The key is to scout early and often, and if you see so many marauders that you know there's two tech labs, do a starport after two gates and make two Void Rays (chrono boosted) while focusing on stalker production.
Late-game, if your opponent is still doing this, thank them for the easy win and make a healthy gateway army backed by Colossi or HT. If there's heavy Viking pressure, make sure you hold back stalkers and tech to blink so that you can protect Colossi. Likewise, if they get ghosts to counter your HT, stop using so many because there's no contest there in terms of range and effectiveness. Ghosts are just better, so start making other units.
Mass hydras?
Mass hydra is pretty similar to MMM in the sense that it's a ground-based ranged army that will wipe your gateway units with relative ease. Against hydra based forces you need to make use of guardian shield and storm/colossi to take advantage of their low health. Critical mass Colossi is 3 because that's what it takes to one shot Hydralisks. If you can mass to 6 of them and get sentry/stalkers to stand beneath them and defend them against lings, roaches and corruptors, hydra armies will melt pretty easily.
Early marine/tank push?
When I see the signs of this I usually go straight to the twilight council, get blink, and mass stalkers. If the push comes before blink, you need a couple zealots to right click on the tanks while your stalkers attack the marines and you'll do okay. If they get siege mode first and wait for a few tanks, separate control groups of stalkers can blink on top of the tanks and end them right there, since they don't have the marauders needed to take out the stalkers.
Mass vikings?
Stalkers without blink can defend against viking attacks, stalkers with blink can defend and follow up by killing the entire force of vikings.
None.