A state ballot measure to ban gay marriage in California is gaining momentum, with polls showing almost even odds of it passing after trailing by double digits a month ago.

In June, the state legalized same-sex marriages. The next month, Proposition 8, defining marriage as between a man and a woman, was put on the ballot for November. Initial...