Marine environments are a reservoir of relevant information on dangerous contaminants such as hydrocarbons, as well as microbial communities with probable degradation skills. However, to access microbial diversity, it is necessary to obtain high-quality DNA. An inexpensive, reliable, and effective metagenomic DNA (mgDNA) extraction protocol from marine sediments contaminated with petroleum hydrocarbons was established in this study from modifications to Zhou’s protocol. The optimization included pretreatment of sediment with saline solutions for the removal of contaminants, a second precipitation and enzymatic degradation of RNA, followed by purification of mgDNA extracted by electroelution. The results obtained indicated that the modifications applied to 12 sediments with total petroleum hydrocarbon (TPH) concentrations from 22.6-174.3 (μg/g dry sediment) yielded 20.3-321.3 ng/μL mgDNA with A260/A280 and A260/A230 ratios of 1.75 ± 0.08 and 1.19 ± 0.22, respectively. The 16S rRNA amplification confirmed the purity of the mgDNA. The suitability of this mgDNA extraction protocol lies in the fact that all chemical solutions utilized are common in all molecular biology laboratories, and the use of dialysis membrane does not require any sophisticated or expensive equipment, only an electrophoretic chamber.