HH UMa and V1175 Her are two W UMa contact binary systems whose periods were reported as undergoing secular increase. In this paper, we improved their period analyses with a more extensive database of eclipse timings, finding that both periods show cyclic variation. The cyclic variation could be attributed to a Light Travel Time Effect (LTTE) induced by a third body. Both circular orbit and eccentric orbit cases were considered. For HH UMa, A cyclic variation with a period of around 20 yr has been detected, which may be caused by a third body with the mass larger than 0.23 M⊙. However, no parabolic variation was detected in its O-C curve, implying the balance of the mass transfer between the two components and the angular momentum loss from the binary system. As to V1175 Her, a long-term period increase superposed on a periodic oscillation was detected. The period increase at a rate of about dP/dt = 2×10−7d · yr−1 indicates the mass transfer from the less massive component to its companion. And the cyclic variation of about 7.5 yr could be caused by a hierarchical third body with a minimal mass exceeding 0.46M⊙ orbiting around the central binary. This mass is larger than that of the less massive component of the binary, which means that the secondary component was not replaced by the third body during early stellar interactions, implying it keeps original dynamical information. By removing angular momentum from the central binary system, the tertiary component has played a significant role in the formation of contact binaries.