Microorganisms play an important role in the natural attenuation process of petroleum hydrocarbons removal from the environment. Microorganisms can produce a series of enzymes to utilize and degrade these organic contaminants. The genes encoding the key enzymes in the hydrocarbon biodegradation pathway are called as function genes. Therefore, studying the function genes for petroleum hydrocarbon degradation is an important basis for analyzing the diversity of indigenous microbial communities, evaluating the natural decaying potential and constructing the genetic modified strains. This review introduces the aerobic and anaerobic microorganism for biodegradation of alkanes and aromatic compounds. The major function genes for the degradation are summarized, including genes encoding monooxygenases and dioxygenases.