Oil prices are currently around the $100 a barrel mark after surging as high as $147 in July.
As crude prices have soared this year, oil imports also increased by about 15% in the month - taking the petroleum deficit to a record $43.3bn.
Excluding petroleum products the US trade deficit shrank to its lowest level since October 2002.
Meanwhile, US exports got a boost from the weakening of the dollar as it made US goods more attractive to other countries.
As a result exports of goods and services rose 3.3% to a record $168.1bn.
Analysts said that exports should remain strong despite fears the dollar's recent strength against the euro and other major currencies would make US-made goods less competitive on international markets.
635
How oil prices influence the US economy
Rising oil prices saw the US trade gap swell in July to its widest level since March 2007