"AI is one of the most transformative technologies of our time and has the potential to help solve many of our world's most pressing challenges," said Microsoft chief executive Satya Nadella.
"By bringing together OpenAI's breakthrough technology with new Azure AI supercomputing technologies, our ambition is to democratize AI."
A joint statement noted that OpenAI is producing "a sequence of increasingly powerful AI technologies, which requires a lot of capital for computational power" and that the agreement with Microsoft would help in commercializing these products.
OpenAI was launched in 2015 with financing from tech entrepreneur Musk, LinkedIn founder Reid Hoffman and Peter Thiel, a co-founder of PayPal with Musk who has been active in technology and who is an ally of President Donald Trump.
Musk and others have warned that AI could pose risks to humanity if mismanaged, allowing the potential emergence of "Terminator"-type killer robots, for example.
OpenAI researchers early this year announced they had developed an automatic text generator using AI so good that it was keeping details private.
Microsoft is also a member of the nonprofit "Partnership on AI" focused on helping the public understand the technology and practices in the field along with Amazon, Google, Facebook and IBM.