The problem with forging such an alliance lies with Russia, which's expansionist tendecies bring it in conflict with all it's neighbours, regardless of geography or religion. That eastern Poland had a substantial Orthodox population and the Ukraine was a rich province just fuels russian greed.
Poland simply being stronger won't do - it was routinely curp-stomping Russia in the XVI ad XVII centuries, yet Russia simply went on to try again. 1640 is to late to have such an alliance formed via a Union (Polish king as Tsar of Russia during the Time of Troubles) or to substantially change the autocratic paranoid regime of the tzars (get rid of the mongols, or Ivan IV at least). Sweden could only serve as a permanent threat for both Poland and Russia long, unless it somehow became the "Kingdom of Scandivavia", it's policy colliding with both Poland and Russia. Turkey could serve as another enemy for both of them.
Alternately, one could try to form a personal union between Poland and Russia in the XVIII century by having some Tsesarevich elected as King of Poland, and later inheriting the Russian throne. Difficult seeing that King of Poland had to be Catholic, but rules could propably change. Maybe Alexei Petrovich could somehow have for of his fathers as well as of the Polish Nobilities favour and be elected as King of Poland after the Great Northern War? Would require him to partcipate in it to a significant extent, so that would propably be a childhood PoD for him.