What can I do to maximize my chances of getting into a CS PhD program if I switched to a CS major during my junior year?
The first two years of undergrad in the US are mostly general education classes anyway, so I wouldn't worry about it. It is common to switch majors.

You seem like you are in great standings. You've taken a fair number of CS classes, received good grades, and will have two good letters. On top of that you'll have research experience and plan to take a few graduate courses.

From the little info you've provided, you seem like you are well on track!