Chevron, Exxon, BP, etc. are in two fairly distinct industries. They recover crude from the earth, and the refine it into refined petroleum. While they're fairly likely to keep things moving internally, they will buy or sell crude if they have excess refinery capacity or crude on hand (respectively) or if they have someone offering to either sell them crude for less than they can recover it themselves or someone offering to buy for more than they think it's worth.
It would not be unheard of for BP to sell a bunch of crude to Exxon today only to turn around and buy some back from Chevron tomorrow or even 5 minutes from now. Perhaps Exxon is offering to pay more to BP than Chevron is offering to sell to BP for (hence BP can turn a quick profit on the buy/sell and may even do a buy/resell) or Chevron has crude near a BP refinery while BP has crude near an Exxon refinery.
Also, much of the oil is refined by companies unrelated to whoever actually captures the crude. Think Saudi oil being used in the USA. The Saudis drill for and pump it, it gets shipped to the US, then it is refined in the US (into gasoline, diesel, kerosene, and other stuff) and shipped (again) to retail markets. Hence, there's quite a market for crude oil.
One might argue that is BP can recover crude, refine it, and deliver gasoline and diesel cheaper than doing the same with middle eastern originated oil, they ought to sell it cheaper. While they COULD sell it cheaper, they have absolutely no reason to do so. They are always able to sell that crude at or close to the market price, so they have no reason to value it any lower, even if their costs on it are lower.
Likewise, there is also a market for refined petroleum. This is largely how wholesale gasoline prices are determined. Retail prices are another beast entirely. The reason they tend to fluctuate a lot has to do not just with the volatility (heh) of the wholesale market but also the fact that, while gasoline is a fairly inelastic good (meaning people will tend to buy about the same amount at any price, at least in the short run), the retail gas market is extremely competitive. The demand inelasticity encourages retailers to experiment with price hikes, but the large amount of competition forces them back to whatever the market will put up with in short order.
FYI, retail margins on gasoline are often less than $50 on an entire tanker load. They make their money on the convenience store and other value adds. Generally, blaming local retailers for gas prices is counterproductive, at best. (And no, I don't work for a gas retailer or a petroleum or petrochem company).