The three companies are amongst those who have signed up to the Global Network Initiative (GNI), an organisation formed to promote a set of principles by which its members agree to abide.
Search engine and internet companies have faced controversy in the past because of governments' demands for information about the online activities of citizens, often political opponents.
Yahoo! faced criticism across the world after it handed user information to Chinese authorities who then identified and jailed dissident bloggers. Google has faced enduring criticism about the way it handles the massive amounts of data it gathers on users, and about reported government censorship of search results in China.
The GNI principles, though, commit the companies to opposing such requests even if they are in line with domestic law.
"When required to restrict communications or remove content, participating companies will … challenge the government in domestic courts or seek the assistance of relevant government authorities, international human rights bodies or non-governmental organizations when faced with a government restriction that appears inconsistent with domestic law or procedures or international human rights laws and standards on freedom of expression," said the principles.
GNI guidance on how to apply the principles said that companies need not challenge every single request received.
"It is recognized that it is neither practical nor desirable for participating companies to challenge in all cases," it said. "Rather, participating companies may select cases based on a range of criteria such as the potential beneficial impact on freedom of expression, the likelihood of success, the severity of the case, cost, the representativeness of the case and whether the case is part of a larger trend."
The companies have also agreed to change their data collection policies according to the dangers presented by national governments to the security of that information.
"Participating companies will assess the human rights risks associated with the collection, storage, and retention of personal information in the jurisdictions where they operate and develop appropriate mitigation strategies to address these risks," said the principles.
The new body has been created to promote good privacy practice and the rights of internet users to communicate freely and in privacy, it said.
"The Initiative is founded upon new Principles on Freedom of Expression and Privacy – supported by specific implementation commitments and a framework for accountability and learning – that provide a systematic approach for companies, NGOs, investors, academics and others to work together in resisting efforts by governments that seek to enlist companies in acts of censorship and surveillance that violate international standards," said the body.
Its members include campaigning groups such as the Center for Democracy and Technology and Human Rights Watch as well as investors and Google, Microsoft and Yahoo!.
"We have joined this initiative because we know that a wide range of groups working together can achieve much more than the company acting alone. The principles we're announcing today are universal," said Andrew McLaughlin, director of global public policy at Google.
"Yahoo! was founded on the belief that promoting access to information can enrich people’s lives, and the principles we unveil today reflect our determination that our actions match our values around the world," said Yahoo! founder and chief executive Jerry Yang. "These principles provide a valuable roadmap for companies like Yahoo! operating in markets where freedom of expression and privacy are unfairly restricted."
Companies which join the GNI will submit themselves to independent audits of the degree to which they are complying with its principles, the GNI said.
"Participants will be held accountable through a system of (a) transparency with the public and (b) independent assessment and evaluation of the implementation of these Principles," it said.
"Thanks to hard work and cooperation from all parties, the Initiative sets the kinds of standards and practices that all companies and groups should use when governments threaten internationally recognized rights to free expression and privacy," said Google's McLaughlin in a statement.
"The Global Network Initiative also offers an important commitment from all parties to take action together to promote free expression and protect privacy in the use of all information and communication technologies," he said. "We know that common action by these diverse groups is more likely to bring about change in government policies than the efforts of any one company or group acting alone."