Senator John McCain was on a roll. In a room reserved for high-stakes gamblers at the Foxwoods Resort Casino in Connecticut, he tossed $100 chips around a hot craps table. When the marathon session ended around 2:30 a.m., the Arizona senator and his entourage emerged with thousands of dollars in winnings.

A lifelong gambler, Mr. McCain takes risks, both on and off the craps table. He was throwing dice that night not long after his failed 2000 presidential bid, in which he was skewered by the Republican Party’s evangelical base, opponents of gambling. Mr. McCain was betting at a casino he oversaw as a member of the Senate Indian Affairs Committee, and he was doing so with the lobbyist who represents that casino, according to three associates of Mr. McCain.

The visit had been arranged by the lobbyist, Scott Reed, who works for the Mashantucket Pequot, a tribe that has contributed heavily to Mr. McCain’s campaigns and built Foxwoods into the world’s second-largest casino. Joining them was Rick Davis, Mr. McCain’s current campaign manager. Their night of good fortune epitomized not just Mr. McCain’s affection for gambling, but also the close relationship he has built with the gambling industry and its lobbyists during his 25-year career in Congress.

As a two-time chairman of the Indian Affairs Committee, Mr. McCain has done more than any other member of Congress to shape the laws governing America’s casinos, helping to transform the once-sleepy Indian gambling business into a $26-billion-a-year behemoth with 423 casinos across the country. He has won praise as a champion of economic development and self-governance on reservations.