The 60-page filing, presented in San Francisco Superior Court, alleges that the companies sell rights to based on searches for terms such as "illegal gambling," "Internet gambling" and "California gambling."
The online businesses also usesoftware to target particular regions, including California, for illegal gambling ads, according to the lawsuit.
The lawsuit demands that the companies stop accepting the advertisements and give California "millions of dollars in ill-gotten gains," said attorney Ira Rothken, one of several attorneys from firms involved in the class-action lawsuit.
The suit is the latest to involve, which has become a multibillion-dollar-a-year business and is usually focused on online poker or blackjack. Wireless interests, including European service providers, also offer gambling opportunities to their subscribers.
Yahoo and Google, in turn, rake in a majority of the millions of dollars gambling firms spend on advertising, according to the lawsuit. Representatives from the two companies did not return a call seeking comment.
In all, about a dozen high-profile Web companies are named as defendants. Included among them is CNET Networks, publisher of News.com.