Shao Zongqi was caught by police in Banqiao village in Tengchong county after being at large for four days and nights, officials said.
The 38-year-old is suspected to have carried out the killings with a semi-automatic rifle on January 30, on the eve of the Chinese New Year, after he discovered his wife had been having affairs with two men - Shao Zongping and Shao Zonghua - from the same village.
Shao allegedly killed Zongping, his wife and two sons, and Zonghua's father and wife.