The all-atom optimized potentials for liquid simulations (OPLS-AA) force field is a popular force field for simulating biomolecules. However, the current OPLS parameters for hydrocarbons developed using short alkanes cannot reproduce the liquid properties of long alkanes in molecular dynamics simulations. Therefore, the extension of OPLS-AA to (phospho)lipid molecules required for the study of biological membranes was hampered in the past. Here, we optimized the OPLS-AA force field for both short and long hydrocarbons. Following the framework of the OPLS-AA parametrization, we refined the torsional parameters for hydrocarbons by fitting to the gas-phase ab initio energy profiles calculated at the accurate MP2/aug-cc-pVTZ theory level. Additionally, the depth of the Lennard-Jones potential for methylene hydrogen atoms was adjusted to reproduce the densities and the heats of vaporization of alkanes and alkenes of different lengths. Optimization of partial charges finally allowed to reproduce the gel-to-liquid-phase transition temperature for pentadecane and solvation free energies. It is shown that the optimized parameter set (L-OPLS) yields improved hydrocarbon diffusion coefficients, viscosities, and gauche-trans ratios. Moreover, its applicability for lipid bilayer simulations is shown for a GMO bilayer in its liquid-crystalline phase.