HOUSTON—BP PLC said Monday it has agreed to sell its Carson refinery in southern California and related assets to Tesoro Corp. for $2.5 billion, as part of its $38 billion asset-disposal plan intended to repay costs stemming from the Deepwater Horizon oil rig explosion and refocus the company after the subsequent Gulf of Mexico oil spill.

The all-cash deal brings BP closer to its goal to at least partially cover the huge cost of the deepwater well blow-out in the U.S. Gulf of Mexico that in 2010 killed...