Preheat your oven to 375°F.
In a large skillet over medium heat, cook the ground beef and diced onion for 5-7 minutes until browned and the onion is translucent. Drain excess fat.
In a large bowl, combine the cooked beef mixture with shredded cheddar cheese, sour cream, and cream of mushroom soup. Mix until well combined.
Grease a 9x13-inch baking dish and spread the beef mixture evenly across the bottom.
Arrange the frozen tater tots in a single layer on top of the beef mixture.
Mix ketchup and mustard in a small bowl and drizzle over the tater tots. If using, sprinkle pickles on top. Bake for 30-35 minutes until tater tots are golden brown and crispy.
Let the casserole cool for 5 minutes before serving. Garnish with sliced green onions.