Melt butter in a large skillet over medium heat. Add sliced onions and cook, stirring occasionally, until deeply caramelized, about 30-40 minutes. Stir in sugar, salt, and pepper during the last 10 minutes.
Cook pasta according to package directions. Reserve 1 cup of pasta water before draining.
Add cooked pasta to the skillet with caramelized onions. Pour in heavy cream and toss to coat. If the sauce is too thick, add some reserved pasta water until desired consistency is reached.
Stir in Gruyere cheese until melted and creamy. Season with additional salt and pepper to taste. Serve immediately.
Notes
Enjoy this rich and flavorful French Onion Pasta. Garnish with fresh parsley for an extra touch.