Shulchan Aruch HaRav chapter 316, states that one may not trap a creature that merely causes pain but does not injure. If one is being actively bitten he may take hold of the creature and throw it away (while being careful not to kill it).
One may however, even initially, trap a creature who's sting or bite commonly injures or is deadly (and in some situations kill it outright).
It follows that it would depend what effect the mosquito's bite has on you. If you are highly allergic to the point that it would cause you injury, or live in an area where mosquitoes carry serious diseases, you would be permitted to trap it. If however, like most of us, the bite only causes discomfort or even pain, you would nonetheless be forbidden to trap the mosquito, unless it is actively biting you.
See here Halacha 17 through 19, for more information, including the reasoning behind these rulings. (See further for when and how a dangerous creature may be killed.)