Don't store tomatoes in plastic bags! The trapped ethylene will make them ripen faster.
Unripe tomatoes should be kept stem side down, in a paper bag or single layer in a cardboard box in a cool area until they turn red in color. To ripen faster, store with fruit. The gases emitted will help ripen the tomatoes.
Perfectly ripe tomatoes should be kept at room temperature, on the counter away from sunlight, in a single layer, not touching one another, stem side up.
Overly ripe tomatoes should be put in the fridge, but let them come to room temperature before eating them.