The forward came off the bench to net in the 89th minute on Saturday – with the goal earning the Saddlers a point in a 1-1 draw at Oakwell.
Since joining from Tranmere in the summer, Cook has had a string of bad luck in front of goal.
The 27-year-old hit the post against Plymouth and then the bar at Scunthorpe. He also saw Rochdale keeper Magnus Norman save a powerful strike with his face.
But Keates believes his striker will now be more relaxed after netting against the Tykes.
“He (Cook) can take so much pleasure from that goal,” the boss said.
“It’ll boost his confidence and he can take it forward.
“He has been unlucky the past few weeks and he had been getting frustrated.
“You look at Rochdale and he could have put us 3-0 up but it has hit the keeper flush in the face.
“Even in training, he was connecting with them unbelievably well and the keepers were pulling saves off.
“He just needs to calm down a little bit, breathe and not let it play on his mind too much. It had been coming but the goal at Barnsley will do him the world of good.”
Cook was a surprise omission from the starting line-up at Oakwell, with Kieron Morris also left out.
Both players were named on the subs bench after Keates opted for a formation change.
And the boss said both players understood why they were left out.
“I had a chat with Andy and Kieron and explained the reasons why,” Keates continued.
“They understood – it was tactical and nothing to do with performances.
“They have both been outstanding. It’s just something we wanted to look at.
“With Barnsley having that extra body in midfield it was always going to be difficult for us. We felt like we had to match them up.”
Meanwhile, Keates confirmed Zeli Ismail has had a bit of a reaction to the hamstring injury that kept him out of the games against Gillingham and Wimbledon.
“Zeli has had a little bit of a reaction with his hamstring,” he added.
“He is not far away but he wasn’t ready for Barnsley.”