According to a report in Express.UK, Federer will partner Gates for the Silicon Valley charity event on Tuesday.
Federer will first play a three-set singles match against Sock and will then team up with Gates for a one-set doubles match.
The charity event will take place at the SAP Centre in San Jose and the money raised will go to poor children in southern Africa and Switzerland.
"I believe in the power of people," Federer wrote on the foundation's official website.
"They might only need some initial empowerment. We know that a good education empowers children by allowing them to take their future into their own hands and play an active part in shaping it. And we trust in the best will of parents that they want to ensure the best possible opportunities for their children.
"For more than 12 years my foundation has therefore been committed to enable parents and local communities in providing these children with the opportunity for a good education. We aim to reach a million children by 2018," he added.