Cook the pasta according to package instructions in a large pot of salted boiling water until al dente. Reserve 1/2 cup of pasta water, then drain the pasta.
In the same pot, heat the olive oil over medium heat. Add the minced garlic and sauté for about 1 minute until fragrant, being careful not to burn it.
Reduce the heat to low and add the ricotta cheese, heavy cream, Parmesan cheese, salt, black pepper, and red pepper flakes (if using). Stir until the mixture is smooth and creamy.
Add the cooked pasta to the pot, tossing to coat the pasta in the creamy sauce. If the sauce is too thick, gradually add reserved pasta water until desired consistency is reached.
Remove from heat and serve immediately, garnished with fresh basil.