Extended variational method in statistical mechanics