How do I choose my optocoupler to drive a solenoid with a MOSFET?
A common optocoupler has a current output: you connect the output transistor to Vcc and the emitter will source the current. How much depends on the CTR, or Current Transfer Ratio. That's not very much, and is usually expressed as a percentage. For instance a CTR of 30 % means that you need 10 mA input to get 3 mA output. Use those 3 mA to drive the base of a BJT. You'll want a Darlington to drive get more than 100 mA collector current.

But a Darlington has a high saturation voltage, and may take away too much from the solenoid's power supply voltage. A MOSFET may be better. But MOSFETs are voltage driven, not current driven like BJTs. So you have to convert the optocoupler's output current into a voltage. Nothing more easy: add a resistor between gate and ground, and the current through it will cause a voltage drop, which will turn on the FET.



The nice thing is that you can choose the voltage just by picking the right resistor value. For instance, our 3 mA will cause a 4.5 V gate voltage across a 1.5 k&Omega; resistor. You may be tempted to choose the resistor value rather high, but that's not necessarily a good idea. The optocoupler has a leakage current when off (called "dark current") and that will also cause a gate voltage. You'll have to make sure that won't get high enough to activate the FET. If the dark current is 10 &micro;A ( a rather high value) then the 1.5 k&Omega; resistor will show 15 mV on the FET's gate, and that will be low enough not to switch it on. The 4.5 V from the 3 mA will be enough if you pick a logic level gate FET.

The LTV817 is a low-cost optocoupler which is perfect for this: minimum 50 % CTR, a dark current of only 100 nA, and a maximum collector-emitter voltage of 35 V.
Since the LTV817 has such a low dark current the value of R1 can be increased to 15 k&Omega;. Then 300 &micro;A is enough to get the 4.5 V gate voltage, and the dark current will only cause a 1.5 V voltage across the resistor. At a 50 % CTR you'll only need 600 &micro;A input current. Use 2 mA to have some margin.

For the FET there are plenty of options. The FDC855, for instance, will give you enough current at 4.5 V gate voltage, giving a negligible on-resistance of 36 m&Omega;: the voltage drop is only 24 mV, and the power dissipation 16 mW (that's 0.2 % of the solenoid's power).  

Edit: Selecting the right FET

Like I said there are lots of FETs suitable for your application. I often refer to the FDC855 because it has a good balance between cost and features. For cost the rule is; the lower \$R_{DS(ON)}\$, the more expensive you FET. Yours has only to switch 0.67 A, that's average, and then an extremely low \$R_{DS(ON)}\$ (you can get them down to 1 m&Omega;) is not really necessary.

You found the PMF290XN cheap (though at Digikey it's only 25 % cheaper than the FDC855, not 80 %). It has a somewhat higher \$R_{DS(ON)}\$ of 350 m&Omega;, but that's still no problem. Voltage drop is 240 mV, and power dissipation 160 mW. That's more than the FDC855, but still OK.

The higher \$R_{DS(ON)}\$ also puts a limit to the current. For the PMF290XN that's 1 A, which isn't great, but enough for the application. The 2 A you read in the datasheet is pulsed (a single 10 &micro;s pulse). Don't read it as 2 A continuous would be allowed, the 1 A is Absolute Maximum Rating. The (pulsed) higher currents just show where the graph is heading to.

Have a look at figures 6 and 7 also. Figure 6 shows that 3 V is sufficient for 1.5 A drain current, so more than enough for your 0.67 A. Figure 7 shows that you need 3.5 V for an \$R_{DS(ON)}\$ of 350 m&Omega; at 0.67 A.