Extraneous variables may affect the results of your research and even threaten its validity. They are hard to control, but their influence can be reduced in the following ways:
Assign the subjects to treatment and control groups as randomly as possible.
Match your samples by distributing people with different variables, such as age and gender, as evenly as possible.
Maintain objectivity by avoiding bias.
Adjust the results for the effects of extraneous variables through statistical analysis.