Without a picture of the soil and the insects it is very hard to tell but the most likely identification is:
- fungus gnats: see here and here
- overwatering is the most common problem with house plants and wet soil encourages fungus gnats
If your plants are outside and getting too much water that would match the wilted look the leaves have. The roots are stressed or dead and cannot provide water to the leaves.
Diatomaceous earth might work but it will only catch insects on the surface, not eggs or adults underneath the soil. Read the links for other methods including the last resort method of 5 ml of bleach to one litre of water poured through the plant. Pour more water through after a few minutes. This will kill the fungus gnats but it may kill the plant. Try drying the plant out for a no risk solution.
Please read the links to answers from this site and let us know if the description and solution does the job.