Fog computing (FC) is a promising paradigm to use as an efficient architecture for the Internet of Things applications. Proximity, low latency, flexible resource power, and distributed structure of this architecture are some benefits of it. A huge number of generated data and their requisites to real-time process causes fog nodes offload number of tasks to the others that make trust issues. Here, each clients prefers to offload task to a trusted server, also each server tends to service the trusted clients. This may takes a long especially when we want to consume less energy. In order to encounter this problem, in this paper, we propose a two-way trust management strategy based on Bayesian learning automata. The proposed approach outperforms the other state-of-the-art approaches in terms of the energy consumption, network usage, latency, response time, and trust value.