Aiming at the problem that the existing alternating direction method of multipliers (ADMM) cannot realize totally distributed computation, a totally distributed improved ADMM algorithm that combines logarithmic barrier function and virtual agent is proposed. We also investigate economic dispatch for microgrids considering demand response based on day-ahead real-time pricing (RTP), which forms a source-load-storage collaborative optimization scheme. First, three general distributed energy sources (DERs), renewable energy resources (RESs), conventional DERs and energy storage systems (ESSs), are considered in the method. Second, the goal of economic dispatch is to minimize the sum of three energy generation costs and implement the optimal power allocation of dispatchable DERs. Specifically, the approach not only inherits the fast computational speed of ADMM but also uses barrier function and virtual agent to handle inequality and equality, respectively. Moreover, the approach requires no coordination center and only the communication between current agent and adjacent agent to achieve totally distributed solution for every iteration, which can preserve information privacy well. Finally, a 30-node microgrid system is used for case analysis, and the simulation results demonstrate the feasibility and effectiveness of the proposed approach. It can be found that, the proposed approach converges to the optima when p = 0.01, v = 100, t0 = 0.01 and μ = 2.