WASHINGTON — It was a familiar scene. People crowding shoulder to shoulder stretched their arms to get a photo, even a faraway, grainy one, of Rep. Beto O'Rourke. The congressman commanded the stage and sweated through his shirt under blue-hued spotlights on a muggy evening.

But O'Rourke wasn't tearing up the campaign trail in Texas on Thursday. Upon his return from his 34-day Lone Star State road trip, he traded town halls for a traditional fundraising event in a tavern in northeast Washington D.C. But his momentum followed him to the East Coast — crowds snaked around the block outside the venue, and all 1,400 tickets sold out days in advance.

O'Rourke has proven to be a prolific fundraiser. So far he has relied on a wide base of small-dollar donors, mostly from Texas. But he knows he's going to need all the firepower he can muster in the last two months before the Nov. 6 election to compete with Republican incumbent Sen. Ted Cruz and his allies' onslaught of negative advertising.

"You may have seen some of these ridiculous fear-based campaigns. This guy wants to burn the American flag, he wants to legalize heroin, he wants to open the borders, and he wants to take your guns from you, and he says f--- sometimes," O'Rourke joked, to raucous applause, in one of the two times he said the dirty word during his appearance.

Nearly one-third of O'Rourke's fundraising comes from out of state. The biggest chunk of O'Rourke's out-of-state money comes from California, where O'Rourke is popular with Hollywood and Silicon Valley. A smaller portion comes from D.C., or $214,500 this campaign cycle, according to the Center for Responsive Politics. That count only includes itemized contributions of more than $200.

O'Rourke has been pulling closer to Cruz in the polls — a recent NBC News poll had O'Rourke trailing by 4 points. As of the end of June, he has also nearly pulled even with Cruz in overall fundraising for the race, raising $23.1 million to Cruz's $26 million.

The narrowing gaps have galvanized O'Rourke's supporters, but have also mobilized his opponents.

The Cruz campaign and allied super PACs have released a slew of negative ads attacking O'Rourke for discussing drug legalization, for his involvement in a redevelopment project in El Paso, for his views on immigration and NFL players' protests of police brutality, for a vote against a bill including tax breaks for Hurricane Harvey victims, and for his penchant for swearing at campaign events.

"This is the politics of fear. 'Be afraid of this guy. Let me confuse you about what he wants to do or what he stands for. Let me not describe the future that I want to achieve,'" O'Rourke said.

Though attendees ranged from infants to grandparents, young professionals made up the majority of the crowd.

"Just the fact that so many people are here that aren't Texans and are still willing to support him from so many other states says a lot about the traction his campaign is getting. I think it's really impressive," said Rechna Korula, a Georgetown University medical school student from Houston.

In addition to asking for more donations and pitching the campaign's "sexy" T-shirts, O'Rourke asked the packed room to phone bank and come to Texas to knock on doors.

"Though we have been doing this for the better part of two years, the campaign, in some ways, is just beginning," O'Rourke said.