The only honest answer to how long it takes to play a round of golf is: "It takes as long as it takes." Golf isn't a timed game, like football or basketball, and there are many variables that can affect the amount of time a round can take. The difficulty of the course, the number of players in a group, the skill of the players, the number of holes played, and the pace of other parties of players on the course can all affect the total time of play, but some general observations made over centuries of golfing can at least lead to a fair estimate.
Conventional wisdom holds that the average time to play a round of 18 holes of golf is approximately four hours. For example, the Hammock Creek golf club in Florida tracked average playing times by month for nearly two years, and the average worked out to four hours and eleven seconds. To finish a round in four hours, you'd need to spend an average of a little over 13 minutes on each hole. This amount would include the time walking or riding from hole to hole. To complete a round in four and a half hours, the average time per hole increases to 15 minutes.
All golf courses are not created equal. The USGA assigns slope ratings to golf courses that are an indication of the difficulty of a course. If you are playing a course that is rated as difficult, and you are not a scratch golfer, it's reasonable to expect a somewhat longer playing time than on a course that is not as challenging. There are also par-3 golf courses, where all holes are par-3, and "executive" courses, with par-3 and par-4 holes only, and these courses will play faster on average than a course that also has par-5 holes. Of course, playing nine holes is going to take less time than 18 holes any time, any place, and a capable golfer playing solo likely could play a brisk nine holes in about 90 minutes.
Skill and Number in Party
Scratch players are going to move through a course faster than players with 20 handicaps. It is going to take longer for a foursome to play a round of golf than it normally will for a single player or a pair to play the same course. Even the top pro tour players end up with balls in hazards, holes and heavy brush from time to time, but if your party has a player with a propensity for losing balls or hitting the hazards, an 18-hole round can stretch out to four and a half hours to even five hours or more.
Often, the speed with which you complete your round of golf depends on a number of factors beyond just your ability. If one or more slow groups are playing ahead of you, you'll be forced to wait at each tee box, which results in a longer round. If there's inclement weather that forces you to take shelter or the members of your foursome are overly conversational, your round won't be quick. Also, the time of year and where you play can influence the time it takes to play a round of golf. For example, it's not uncommon for five-hour rounds in Northern states in metropolitan areas during the summer because of the demand for tee times. In a state such as Florida, playing in the heat of the summer usually means courses are fairly devoid of golfers, which means faster rounds, but in the winter, with residents sharing courses with seasonal visitors, a round will take longer.