Attitude estimation is one of the core fundamentals for navigation of unmanned vehicles and other robotic systems. With the advent of low cost and low accuracy micro-electro-mechanical systems (MEMS) based inertial sensors, these devices are used ubiquitously for all such commercial grade systems that need motion information. However, these sensors suffer from time-varying bias and noise parameters, which need to be compensated during system state estimation. Complementary filtering is one of such techniques that is used here for estimating attitude of a moving vehicle. However, the complementary filter structure is dependent on user fed gain parameters, KP and KI and needs a mechanism by which they can be obtained automatically. In this paper, an attempt has been made towards addressing this issue by applying least square estimation technique on the error obtained between estimated and measured attitude angles. The proposed algorithm simplifies the design of nonlinear complementary filter by computing the filter gains automatically. The experimental investigation has been carried out over several datasets, confirming the advantage of obtaining gain parameters automatically for the complementary filtering structure.