A game is considered a regulation game -- also known as an "official game" -- once the visiting team has made 15 outs (five innings) and the home team is leading, or once the home team has made 15 outs regardless of score.
If a game is terminated early due to weather before becoming a regulation game, the results up to the point of the termination will not count and the game will be started over at a later date. In rare instances, rained-out games are never made up if the two teams involved don't have a convenient time to reschedule it before season's end and it is determined that the game will have no bearing on postseason play. For example, the Dodgers and Nationals played 161 games each in 2011 after a rained-out game between the two clubs was never rescheduled.
If a regulation game is terminated early due to weather, the results are considered final if the home team is leading. If the home team is trailing, the results are considered final if the game is not in the midst of an inning when the visiting team has taken the lead.
If a regulation game is terminated early due to weather and the game is either tied or in the midst of an inning in which the visiting team has taken the lead, it becomes a suspended game that will be completed at a later date from the point of termination.
If not terminated early, regulation games last until the trailing team has had the chance to make 27 outs (nine innings). If the home team is leading after the visiting team has made three outs in the top of the ninth inning, the home team wins and does not have to come to bat in the bottom of the ninth.
If the game is tied after both teams have made 27 outs each, the game will go to extra innings. It will continue until the home team takes the lead at any point, or the visiting team takes the lead and the home team subsequently makes three outs without tying the game or going ahead.