Mains switching.
G3MB-202P switches some lighting. 3.3V is below the must operate of 4V but it’s never failed for me. No series resistor needed.
http://www.mouser.com/ds/2/307/g3mb_0609-298620.pdf
Low Voltage switching.
ILD74 in parallel with the ‘manual open’ button on my electric gates (12V). Needs 100 ohms in series with the LED.
http://www.vishay.com/docs/83640/ild74.pdf
One of the advantages of opto-coupling is that as the diode has no ground connection it can be connected between GPIO & Ground or most usefull for use with the ESP8266-01 between 3.3V & GPIO (ideal for GPIO 0 & 2). You do get a flicker at power up or reset (250 mS), for my lights it wasn’t a problem, as I didn’t want the gates to open in this event, the diode was placed between GPIO 0 & GPIO 2 (anode on GPIO 2 if I remember correctly). Taking one GPIO high and the other low switches on the LED. If it’s just for lighting the you won’t this level of control.