This work presents an extension of the state dependent Riccati equation method (SDRE), a powerful technique for optimal estimation and control of nonlinear systems. Following the standard SDRE approach, nonlinear model equations are recast as pseudolinear equations with a state-dependent coefficient matrix. Exploiting the non-uniqueness of this parametrization, this work formulates a nonlinear optimization problem with respect to the weights of linear combination of primary state-dependent coefficient matrices. The measure of performance is the classical infinite-horizon integral cost quadratic with respect to the state and the control. The controller assumes an SDRE-like structure, but where the gains becomes nonlinear functions of the decision variables. The proposed solution implements two types of gradient-based iterative methods (steepest descent and Newton steps) where the gradient of the integral cost is numerically evaluated. In order to allow for on-line implementation, a simpler suboptimal algorithm is devised where the controller switches among a finite set of possible SDRE controllers, which are implemented in parallel. The application of the optimized SDRE method to attitude stabilization for rigid body dynamics with full information and actuation is developed and illustrated via numerical simulations. Further, the application to attitude and attitude rates estimation is described and implemented on a numerical example. Extensive Monte-Carlo simulations show satisfying performances of both the stabilization and the estimation applications.