The lawsuit was filed against the U.S. Pipeline and Hazardous Materials Safety Administration on behalf of San Francisco by City Attorney Dennis Herrera.
The agency is a division of the U.S. Department of Transportation, which was also named as a defendant.
The suit claims the agency has "abjectly failed" to oversee a state pipeline safety program.
Herrera charged in the suit that unless the agency corrects its alleged abdication of its duty, "it is not a question of if another pipeline will explode, but a question of when."
The lawsuit cites the explosion of a PG&E natural gas pipeline in San Bruno in 2010, in which eight people were killed, as well as two other explosions in Rancho Cordova in 2008 and Cupertino in 2011.
Under federal law, the U.S. secretary of transportation must prescribe minimum safety standards for natural gas pipelines and then oversee state agencies in enforcing those standards. In California, the state agency is the Public Utilities Commission.
The lawsuit charges that the federal agency has been shirking its duty to make sure the CPUC enforces the standards for at least a decade.
The lawsuit seeks a court order requiring the agency to carry out its enforcement duties.
Herrera said three major natural gas transmission lines, including the one that exploded in San Bruno, run under densely populated business and residential areas of San Francisco.
The lawsuit alleges that the federal agency's failure to oversee pipeline safety has placed the lives and property of "hundreds of thousands of men, women and children in San Francisco at risk."
A spokesperson for the agency was not immediately available for comment.
In a notice of intent to sue issued last year, Herrera originally said he planned to sue the state commission as well.
But Herrera said today that the commission is not included in the lawsuit because it has begun to take steps to improve its enforcement and regulatory practices.