Melt butter and olive oil in a large pot over medium heat. Add onions and cook, stirring occasionally, until caramelized and golden brown (about 30-40 minutes). Add sugar, salt, and pepper during the last 5 minutes of cooking.
Pour in beef broth and sherry. Bring to a simmer and cook for 15-20 minutes.
Preheat broiler. Place French bread slices on top of oven-safe bowls. Ladle soup over bread. Top with Gruyere cheese.
Broil until cheese is melted and bubbly (about 2-3 minutes).