Gay hotels in Barcelona are most densely located in Gaixample, the gay district in the Eixample Esquerra. Those who live here have bars, clubs and cafés right on their doorstep and short distances to the metro and city centre. Several houses in the district are explicitly aimed at gay guests or openly advertise their queer-friendly attitude. The Eixample is also a good base for sightseeing, as the Sagrada Família and Passeig de Gràcia with the Gaudí buildings are within walking distance or a short metro ride away.
But you are not committed to the Gaixample. Barcelona is an open city, and in almost every accommodation it is a matter of course for two men to book a double room. In the old town around the Ramblas and the Gòtic, you live closer to the harbour and the beach, but louder and more touristy. Things are quieter and a little more alternative in Gràcia. Which location is worthwhile depends on what you have in mind: night owls drive the shortest from Gaixample, those who want beach and tapas are in good hands in the direction of Barceloneta. Plan early if you're visiting for Pride at the end of July or the Circuit Festival at the beginning of August, as the central venues fill up quickly.