The middle and anterior superior alveolar nerves originate from the infra-orbital branch of the maxillary nerve [V2] in the floor of the orbit:
The middle superior alveolar nerve arises from the infra-orbital nerve in the infra-orbital groove, passes through the bone in the lateral wall of the maxillary sinus, and innervates the premolar teeth via the superior alveolar plexus.