Fruit flies are a pain. They thrive in moist damp places and absolutely love fruit, especially ones that are rotting or fermenting. To get rid of these tiny bugs, I use a couple of different methods.
The first thing I would recommend though, is removing the rooting fruit from the area and throwing it away. You could also place some of the remaining fruit in the fridge, bake with it (things like apple crumble or banana bread) or simply eat it.
Fruit flies tend to breed in wet places like in your drains. I recommend pouring a mix of half white vinegar and half boiling water down your drain on a daily basis to stop them breeding.
First, heat up about 1/2 cup (170g or 6 oz) of apple cider vinegar. This helps to release a more irresistible fragrance.
Pour the warm apple cider vinegar into your jar.
Add a couple of drops of dish soap onto the apple cider vinegar. This helps to break the surface tension, stopping the fruit flies from sitting on top of the liquid.
Cover the top of the jar with cling wrap, using the rubber band to hold it in place. Prick some holes into the cling wrap with a fork or toothpick and place the jar where close to the fruit flies. you could add an overripe piece of fruit into the mixture before adding the cling wrap for extra temptation.
The other method I use to keep the fruit flies at bay is this lemongrass spray.
In the spray bottle add the essential oil of your choice and the hot water. Shake well.
Spray along the windowsills, doorways and directly on the fruit flies.
It seems that fruit flies don’t like basil. If you grow your own herbs, you could place your basil pot plant in the kitchen near the fruit bowl. You may also like to pick some of your basil leaves, wash and dry them and place them on your fruit.