Everything created was created for the purpose of serving G-d's ultimate plan for his creation which is to acknowledge G-d. What lesson or use can we make from mosquitos?
The mosquito does serve somewhat as a giver, the Rebbe explained. Its contribution is the lesson it provides for us. The mosquito is the one who teaches us the very concept that to be a G-dly creature in this world you must contribute!
You can learn a lesson from everything you see -- either what to do, or what not to do!
(~ a wise friend)
This is adressed in the Tiferes Yisroel on Avos, ch. 4 mishna 3, oisios 20 & 21.
The mishna says ואל תהי מפליג מכל דבר, don't be seperated from anything. The T.Y. explains this to mean not to question any of Hashems creations and to assume there is a good reason for them, even if we don't know the reason. He singles out the fly the gnat and snakes and scorpions as questionable being that they bite and are bothersome. He says that flies and gnat help in so far as their flying around helps move stale air, therefore in hot humid places we find more of these bugs. End quote.
We perhaps won't appreciate his scientific explenation nowadays but his basic intent still stands.
the purpose of nature is to provide a misleading appearance that the world carries itself. Therefore, when nature was created, with it came the loopholes for interpreting the world according to the view that the universe always carried itself. Even though, it was 5 minutes old, Adam looked like a 30 year old man. Likewise, the light from stars millions of light years away reached the Earth. It is part of the creation of nature.
This is why we have evidence in nature of common ancestry (chromosome fusion, viral DNA, etc.), or that the world appears billions of years old as a result of some cosmological accident, etc. etc. Likewise, we have things which don't seem to be of use to man, such as mosquitos, deep-sea creatures, or a vast universe.
source: based mostly on some lectures I heard from Rabbi Dovid Gottlieb