Super altare Beatæ Mariæ in occidentali porte ejusdem ecclesiæ quæ Galilæ a vocatur. [c.1186 charter in "Durham Cathedral"]
Sense of "building to house art" first recorded 1590s; that of "people who occupy a (theater) gallery" (contrasted with "gentlemen of the pit") first by Lovelace, 1640s, hence to play to the gallery (1867).