It depends on the hotel. Typically playing a couple hours of table games (any level) will get you a free buffet.
To get a free room at a hotel like the Paris, New York, Treasure Island etc., 4 hours of $50 black jack will usually do it, but there are no hard and fast rules. Do be freindly to the dealers and bosses, Do join the comp club, Do understand the mechanics of the game, Don't be a drunk, Don't be rude to other players, and above all DON'T BE AFRAID TO ASK FOR A COMP!
The squeeky wheel gets the grease