No, you can’t keep just two mollies. Mollies are shoaling fish, which means they seek safety and comfort in numbers. Even though keeping a pair of mollies is better than keeping only a single molly, it’s not enough. Mollies are more comfortable when they live in a larger group of at least three or four fish.
Make sure the tank is big enough to accommodate them all. As a general rule, a one-inch fish requires one gallon of water. On average, mollies grow to be 3–4.5 inches long, so each fish needs around three gallons of space to swim freely.
Thus, a 10-gallon tank should suffice for three mollies to cohabit comfortably.