Males of many species guard their mates to prevent rivals from usurping paternity of the potential offspring. Environmental conditions, such as temperature, may affect a male’s ability to guard a female effectively and consequently the amount of sperm competition that occurs. We tested whether temperature and light affected mating behavior in laboratory experiments on the Japanese beetle, Popillia japonica Newman, a species in which males guard females for minutes to many hours after mating. When tested in groups, under conditions of high temperature and high light, males guarded females for shorter periods of time and males and females both mated with more different individuals. The number of mating pairs observed at any one time, however, was lower under conditions of relatively high temperature and light, which agrees with field data and is likely due to a combination of shorter pair durations and a period of time between successive mates. Contests for females were rare, which indicates that these patterns were due to changes in the behavior of the male and/or female of the pair. To tease apart male versus female roles in these patterns, single males were given dead females for copulation and guarding. When single males mated with the dead female, light and temperature still affected guarding behavior (e.g., the shortest durations were under conditions of relatively high temperature and light), indicating that males play a major part in determining the duration of mate guarding, probably due to a change in the costs the males are incurring. However, the patterns in the dead female experiment were not identical to the patterns in the group experiment, implying that female behavior also plays a role in guarding time. Our results demonstrate that environmental conditions can have a major effect on sperm competition risk and suggest that males would benefit greatly from being able to mitigate, either morphologically, physiologically, or behaviorally, the impact of those conditions.