What is the best way to remove gasoline odors?

One thing you should never do is throw it in the laundry machine, and especially not the dryer. It is not an uncommon cause of fires that someone uses either gasoline, naptha, linseed oil, kerosene, turpentine, or some other flammable liquid immiscible with water and wipes residue on their clothing, then throws it in the laundry basket. An unsuspecting spouse or caretaker puts it in the wash, then in the dryer, and at a critical temperature the liquid reaches its lower explosive level and starts a fire in the dryer, igniting lint in the dryer line and the remainder of the house.
Gasoline is a known carcinogen, contains small amounts of Polycyclic aromatic hydrocarbons and benzene, and is dangerous- easily explosively flammable, between 1.4% and 7.6% in air. For anything other than tiny amounts, consider anything that is stained or otherwise permeated with gasoline to be ruined, and dispose of it carefully according to your municipal guidelines.
A professional dry cleaner is likely your best bet for small patches- they are used to dealing with hazardous fumes and can provide suggestions or can take care of it themselves. The typical dry cleaner would use something like steam if it can be boiled off and the underlying fabric can tolerate steam, or dry cleaning liquid (or supercritical CO2) to remove it if steam is unsuccessful. For carpet or indoor surfaces, a professional steam cleaner will wear proper protective gear to make sure they don't inhale the steam-evaporated fumes, nor ignite them.
Do not try to mask the scent. Sometimes, the scent is someone's only warning that an object has touched or absorbed gasoline and is potentially flammable. Avoid breathing the scent.
If you have the luxury and don't want to dispose of it properly despite my warnings, let it air on a clothesline in the sun, away from ignitable surfaces, until the smell is barely perceptible, then hand wash with detergent and hang dry.
You should consider a nonionic surfactant or product cantaining one. 2-Butoxyethanol, aka Ethylene Glycol butyl ether, or other ethoxylated or butoxylated alcohols, will dissolve the gasoline. But, this just leaves you with two problems- what do you do with a mixture of two somewhat hazardous substances dissolved in water, and how do you make sure you've rinsed them all out of your affected area and not just masked the problem? You see, even if the gasoline is dissolved away in water, you are still poisoning the water with a carcinogen, and because that carcinogen is now soluble in water, it is even easier to soak in through your hands or pass on in recycled water to the environment or other people.
Do not use industrial strength nonionic surfactants in automatic washing machines, for sure. You will cause yourself more problems later, and possibly cause gaskets or flexible tubing to fail. Hand wash only.
In short- set it on fire (safely), or just dispose of it in hazardous waste. That's probably the best you can do, without simply passing the problem along to someone else. Just be sure that burning it doesn't create a bigger problem.