Generally speaking, we can divide the Reagan administration into two distinct periods. The first, from Reagan's inauguration to late 1983-early 1984 was defined by bellicose rhetoric and aggressive action against the Soviet Union. It was in this period that Reagan spoke of the Soviet Union of an "evil empire" and stated that Marxism-Leninism would end up on " the ashheap of history." Reagan backed up this confrontational rhetoric with action. In 1981, he instituted the largest peacetime military budget in U.S. history—roughly thirty percent of the entire federal budget. He additionally proposed the creation of a Strategic Defense Initiative (SDI) that would create a “nuclear umbrella” of spaced-based missile defense technology that could protect against any incoming Soviet missiles. It's difficult to overstate how much Gorbachev feared SDI, as he believed that the United States would actually use the technology, nominally for defense purposes, as an offensive weapon. As many critics said of SDI, Reagan was attempting to militarize outer space.
Reagan supplemented the anti-Soviet hostility inherent in SDI’s proposal with even more overt acts of American militarism. In 1983, he approved the commencement of Able Archer, a military exercise meant to test the United States’ nuclear capabilities in the case of war against the Soviet Union. As a part of the exercise, the U.S. Pacific Fleet conducted its largest naval exercise in history right next to Soviet waters. Tensions between the two superpowers neared a boiling point on September 1, 1983, when a Soviet fighter jet shot down Korean Air Lines flight 007, which had inadvertently crossed into Russian airspace. Two hundred and sixty-nine people died, including sixty-one U.S. citizens. By 1983, Reagan’s bellicose rhetoric and policies, in addition to the Korean Air Lines tragedy, heightened Cold War superpower tensions to their highest level since the Cuban Missile Crisis in 1962.
Reagan additionally heightened Cold War tensions through his support for various Third World insurgent groups that were fighting communist-supported governments, most notably in Afghanistan and Nicaragua. Reagan wanted Afghanistan in particular to be the Soviet Union's equivalent to the U.S.'s Vietnam War.
By 1984, a more focused foreign policy agenda within the administration, international pressure from American allies, and Reagan’s desire to dampen hostility between the two superpowers led Reagan to adopt a more cooperative approach toward the Soviet Union. Equally important to this transition in superpower relations was the rise of Mikhail Gorbachev. The U.S. saw Gorbachev as a reformer, someone who the U.S. could work with to lessen or even end the Cold War. The Reagan administration took a less aggressive stance in part to ease Gorbachev's domestic critics that were arguing for a more hardline stance against the U.S. The last thing Reagan wanted was for aggressive U.S. actions to lead to Gorbachev's ouster as Soviet premier and the arrival of a much less cooperative Soviet leader. In many ways, this policy of cooperation continued under George H.W. Bush, who made sure to dampen any triumphalist rhetoric as Eastern European countries began to break away from the Soviet Union. This did much to ensure that Gorbachev was able to stay in power throughout the turbulent period from 1989-1991
Reagan's role in the end of the Cold War was only secondary to Gorbachev's reforms and changes in the structure of the international order. Most prominently, Gorbachev offered a completely different interpretation of American global ambitions than his Cold War predecessors. Gorbachev didn't believe that capitalism was inherently expansionist and that the U.S. was attempting to surround the Soviet Union. As Melvyn Leffler has argued, with this change in Soviet threat perception, Gorbachev was then able to attempt to promote domestic economic and social reform that led to the end of the Cold War. Leffler gives Gorbachev the credit of being the “indispensable agent of change” that brought about the end of the Cold War, with Reagan adroitly maneuvering to accept Gorbachev’s attempts to de-escalate the Cold War while also ensuring that the Cold War ended “on America’s terms.”
While historians debate whether it was Gorbachev or the changing structure of the international order that brought about the end of the Cold War, most scholars agree that Reagan's foreign policy was only a secondary factor. This is not to discount Reagan's role in the end of the Cold War. There were many chances in which Reagan's actions might have actually prolonged the Cold War, particularly if he had continued to act aggressively and forced the Soviet government to go in and militarily repress the revolutions in Eastern Europe. No historian really says that Reagan did a bad job with his Cold War policy. He is generally seen as having skillfully recognzed the changing nature of the international system and the sincerity of Gorbachev's attempts at domestic reform. For this, Reagan deserves a lot of credit at ensuring that the external processes that would eventually end the Cold War took place smoothly.
Some historians argue that Reagan knew what he was doing all along, that historians can't really divide the administration up into two distinct eras--one of conflict, one of cooperation. John Lewis Gaddis is perhaps the most prominent of among this interpretation. More so than just Reagan's presidency, Gaddis argues that the Cold War was primarily an ideological conflict and that the U.S. won due to its greater technological capabilities and the ideological superiority of capitalism and democracy over communism. Hal Brands has recently offered a more moderated view of the triumphalist narrative of Gaddis that still gives a great deal of credit to Reagan. Brands argues that the change in tone toward the Soviet Union was a part of Reagan's plan all along. Reagan's policy was so effective because "the administration underscored Gorbachev's incentives...for moderation and reform, and thereby promoted the transformation of U.S.-Soviet affairs...In the end, Reagan thus succeeded in combining vision with flexibility, strength with diplomacy, and in bringing his grand strategic agenda to fruition."
I don't, however, want to give too much emphasis to the triumphalist interpretation. Most scholars disagree with it, and in large part its popularity derives from Gaddis's popularity as one of the best diplomatic historians of the 20th century (plus, it's a pretty satisfying narrative for Americans). Besides Gaddis, most Cold War triumphalists are former Reagan officials like Jack Matlock, Robert Gates, Richard Pipes, and others. I gave the example by Brands to show a much more measured version of the argument that, while I might still disagree with some of its main claims, I can still respect as a well-structured argument not founded on ideas of American moral superiority.
In contrast to the triumphalists, other historians, like Beth Fischer, argue that Reagan simply bungled his foreign policy in his first term, and was only able to get his act together by late 1984 to enact a successful policy toward the Soviet Union.
Whether triumphalist or not, almost all historians accept that from 1984 onward Reagan handled foreign policy with the Soviet Union incredibly well. Most, however, believe that Reagan's ultimate role was one more as expediter rather than direct cause of the end of the Cold War.
Edit: Sources
Melvyn Leffler, For the Soul of Mankind: The United States, the Soviet Union, and the Cold War
Hal Brands What Good is Grand Strategy?: Power and Purpose in American Statecraft from Harry S. Truman to George W. Bush
Campbell Craig and Fredrik Logevall America's Cold War: The Politics of Insecurity
Beth Fischer, The Reagan Reversal: Foreign Policy and the End of the Cold War
John Lewis Gaddis, The Cold War: A New History
John Lewis Gaddis, Strategies of Containment: A Critical Appraisal of American National Security Policy during the Cold War
Coral Bell, The Reagan Paradox: US Foreign Policy in the 1980s
Reagan was very opposed to the idea of détente, and believed that the détente in the Cold War was merely a 'breathing space' allowing the already strained Soviet economy to build back up, whilst gaining the United States nothing. So in his initial foreign policy, he began a program of increased arms spending, and actively began to oppose the Soviet Union on the world stage again. When discussing why détente ended, historians associate blame with either Reagan and his aggressive new policies, or the USSR's invasion of Afghanistan and its strain on US-USSR relations.
In regards to his aggressive Cold War policy, Reagan's most controversial Cold War policy was probably arming the mujahideen in Afghanistan very heavily. In particular, providing them with Stinger missiles, and allowing them to challenge Soviet aerial supremacy for the first time in the war. This strained relations with the USSR much further, but perhaps even worse for diplomatic ties, was the buildup of arms in the US, and increases in defence spending. In addition, he began the Strategic Defence Initiative (SDI, popularly referred to as the "Star Wars" program). This involved the set up of anti-ballistic missile systems in space. This never came to a head, but at the time it seemed that the system would be capable of removing Mutually Assured Destruction, the system by which a nuclear war had been averted for the better part of 30 years by this point. When Gorbachev came to power, and met with Reagan in 1985 at the Geneva Summit, his main priority was the question of SDI.
In his second term in the presidency, Reagan was much less aggressive in the Cold War. Following Geneva, and subsequent summits at Reykjavik, Washington, and Moscow (86, 87 and 88 respectively), the agreements between the Superpowers led to a cooling off in relations again, though this can largely be put down to the policies of Gorbachev, in both glasnost (openness), and perestroika (restructuring). Throughout these meetings, Reagan was viewed as the only man who could have led to such cooling off in relations with the USSR. He was viewed as a hardline, anti-communist republican, and the fact that he would allow the cold war to die, meant that there was a great deal of credibility back home with the policy.
Now, whether he led to its downfall is the tricky side of the question. That depends on what you define as the end of the Cold War. Some individuals view the Moscow Summit in 1988 as the end of the Cold War, some view the fall of the Berlin Wall in 1989 as the end, and some view it as the breakup of the USSR in 1991. He did a great deal to ease relations between the superpowers by being open to diplomacy in his second term, and having the credibility at home to make these summits carry a great deal of weight in the USA.
Other possible reasons for the ending are attributed to the Soviet side of things, quite likely with slightly more accuracy. By 1985, the Soviet economy was stagnating, and Gorbachev realised that something needed to be done to fix this. As I mentioned above, Perestroika and Glasnost were his primary policies here. Perestroika involved the complete restructuring of the economy, to follow a more free-market ideal and allow for more private sector growth. Glasnost involved removing state censorship of media, and creating more transparency in the government's actions. Unfortunately, by 1990, the Soviet economy had gotten worse, and was declining rather than showing growth. These situations led Gorbachev to actively seek better relations with the US.
When Reagan began to spend more on the military in the early 80s, there is no way the USSR could have engaged in a second arms race. The economy was not prepared, and so you could argue that Gorbachev was forced into diplomacy by Reagan's actions. In short, it can be argued that his actions were a reason for the end of the Cold War. Other factors are the Soviet Economy, and Gorbachev's policies. There are a number of other factors, such as 'people power' that I know slightly less about, that other historians consider important to the fall of the USSR.