Topological optimization finds a material density distribution minimizing a functional of the solution of a partial differential equation (PDE), subject to a set of constraints (typically, a bound on the volume or mass of the material). Using a finite elements discretization (FEM) of the PDE and functional we obtain an integer programming problem. Due to approximation error of FEM discretization, optimization problem becomes mesh-depended and possess false, physically inadequate optimums, while functional value heavily depends on fineness of discretization scheme used to compute it. To alleviate this problem, we propose regularization of given functional by error estimate of FEM discretization. This regularization provides robustness of solutions and improves obtained functional values as well. While the idea is broadly applicable, in this paper we apply our method to the heat conduction optimization. This type of problems are of practical importance in design of heat conduction channels, heat sinks and other types of heat guides.