However, BP's obligations could be rendered void should it prove that Halliburton fraudulently concealed problems with its well cementing job, the judge ruled.
"The court agrees that fraud could void an indemnity clause," Judge Carl Barbier wrote.
"There are material issues of fact that preclude summary judgment on this issue," he added. "The court defers ruling on this issue."
The ruling mirrors a similar judgment issued last week against rig owner Transocean.
Both companies will escape responsibility for "compensatory claims" -- for which BP has already paid out $7.8 billion -- but are potentially on the hook for billions in punitive damages and government fines.
The two subcontractors will also be responsible for hefty legal fees, Barbier ruled.
BP took a $40 billion charge to cover cleanup efforts, compensation to fishermen and thousands of others affected by the spill and massive government fines and penalties that are still being assessed.
It has been fighting to shift some of the financial responsibility to Halliburton and Transocean, which have argued that they should be protected by contracts in which BP agreed to indemnify them against "any and all claims."
Various government probes have spread the blame for the massive spill and the next -- and far more complex -- step in the legal battle is to determine how much each party should pay.
BP hailed Tuesday's ruling as a "strong signal that contractors involved in critical well operations will be held accountable for their actions under the law."
"All official investigations have concluded that Halliburton played a causal role in the accident, and following this ruling, Halliburton is, at a minimum, responsible for any punitive damages as well as civil penalties to the extent that they may apply under the Clean Water Act," BP said in a statement.
Halliburton's reaction was more subdued.
"Halliburton agrees with the ruling to the extent that it requires BP to honor its contractual indemnity obligations," the oilfield services firm told AFP in an e-mailed statement.
An explosion on the BP-leased Deepwater Horizon rig killed 11 people on April 20, 2010.
The rig then sank and the Macondo well gushed oil into the ocean for 87 days, blackening the US Gulf shoreline and crippling the local tourism and fishing industries.
By the time the exploratory well was capped, some 4.9 million barrels (206 million gallons) of oil had spilled out of the runaway well 5,000 feet (1,500 meters) below the surface of the Gulf of Mexico.
Morgan Stanley has estimated BP will end up paying $20 to $25 billion to the US government in order to settle a host of civil and criminal lawsuits arising out of the 2010 disaster.
Thousands of other lawsuits have been launched by people and business affected by the spill, along with state and local governments.
Barbier is handling all related cases in a single complex trial set to begin on February 27.