Prior to the Islamic Revolution, there was a large focus for the US on the Middle East in light of Western influence. Saudi Arabia and Iran thus formed the "Twin Pillars", dedicated to ensuring US influence, stability, and resistance to non-West forces in the Gulf.
There was accordingly a decent amount of cooperation between Saudi Arabia and Iran. Saudi Arabia's King Saud visited Iran in 1955, and the Shah visited Saudi Arabia in 1957. Generally speaking, relations were not tense, but they grew more tense as time went on. Both powers were still competing in many ways for influence in the Gulf, and that was not lost on both.
Tensions grew especially around Bahrain. Bahrain, in case people are unaware, is a very small nation in the Arab world. Iran actually claimed that Bahrain was separated from it when it had historically been part of the Persian empire, and raised the issue often (including with the British, when they controlled the area). Iran thus had a historical claim on Bahrain that they pushed (the validity is not something I'm judging here either way), and there was a growth in tension in 1968 as a result. A few days before the Shah was scheduled to visit Saudi Arabia in 1968, the Saudi King received the Sheikh of Bahrain, and Saudi Arabia declared support for him. That was seen as a very disturbing development for Iran-Saudi relations, though it did not skewer them by any means; the Islamic Revolution was certainly much bigger for that.
This was all roughly swept under the rug and the Shah visited later that year. In October of 1968, they even agreed to terms on a dispute over continental shelf boundaries, and over islands. While the Iranians continued to agitate briefly over Bahrain, in January 1969 the Shah declared that Bahrain should be given the choice to refuse joining Iran. They submitted a request for a report to the UN, asking that the UN make the final decision on the subject and saying that Iran would accept the findings either way. The UN report stated that Bahrain preferred independence, and so Iran's last Shah dropped the issue in 1971, which would reduce tensions somewhat.
Ties were thus normal, prior to the Islamic Revolution. There was less (if any) talk of a sectarian divide between countries than after the Revolution. Relations were not always the way they came to be, and the sectarianism did not always exist, just as Iran and Israel were not always opposed as they became especially post-Iran-Iraq War.
Prior to the 1979 Islamic Revolution, Iran was one of the "Twin Pillars" (corrected) of US foriegn policy and deemed to be the "Policeman of the Persian Gulf" so Iran was the favored power and Saudi Arabia was the lesser but which benefited from Iran providing security in the region (Iran and the UK fought off a Communist insurgency in Yemen/Oman in the 1970s.) So the Saudis grumbled but recognized/were resigned to Iranian ascendancy in the region. Iran is after all a "Natural Hegemon" -- longest coastline, largest population etc.
After the 1979 Islamic Revolution, the relations went bad pretty quickly as there were demonstrations in Mecca sponsored by Iran that challenged the Saudi monarchy's religious qualifications and authority. The Saudis (and Kuwaitis) were also the strongest backers of Saddam while he waged war on Iran.
Followup question: how did the treatment of the Shiite population in the Saudi Eastern Province color relations between the two countries both during and after the Shah and up to '96?
Also, what were relations between the regional powers prior to WW1?