I'm thinking about using 4N25 optocoupler - it has a separate lead for base of phototransistor. How do I use it? I suppose I can't leave it floating?
The base terminal of certain phototransistor optocouplers is exposed to address specific design requirements, such as below. If those requirements do not exist, a part without the base pin might be a better choice - the latter are typically 4 or 6 pin parts as opposed to (usually) 8-pin parts incorporating the base pin: Usually cheaper, less space needed on the board, and less routing too.
To conclude: No, the base should not be left floating, or it will act as an antenna, picking up EMI noise and superimposing it on the output.
There is not much difference than the standard BJT design and an optotransistor. The base can be left floating but it will severely reduce the turn off speed since any internal base capacitance cannot be discharges(which is why they gave you a direct connection to to the base. Optocouplers do not have this connection).
The base picking up spurious EM emissions is not a huge issue with BJT's unless the CTR is very high or in critical applications. You can generally use any optotransistor as an optocoupler. If you want faster speeds you should tie the base to ground through an appropriately sized resistor so that the internal capacitance can discharge in time.
In any case, just treat any optotransistor as a normal BJT circuit, but that the input to the optocoupler has a very high impedance to the base when off(that is, no light = "floating" base). Generally this means you have to have a pull up or down resistor to provide a relatively low path to ground to either prevent spurious results from EM or to allow for discharge of capacitance in a timely manner.