Leeds, 15th in the Championship table, looked vulnerable at the start of the season, particularly at set-pieces.
But central defender Bartley has formed an impressive partnership with Pontus Jansson in recent weeks.
Bartley, on loan from Swansea, told BBC Radio Leeds: "You'd have to give the credit to Pep. He had a look and then changed our set-up slightly."
The Yorkshire side were beaten in their opening two league matches of the season, losing 3-0 at QPR and then 2-1 at home to Birmingham.
But on-loan Torino defender Jansson, 25, has played a key role in their improvement.
Leeds have kept clean sheets in their last two games and conceded just two goals in their last four matches - and just one in their last four away games.
Bartley, also 25, explained: "We have Pontus as a spare man who isn't picking up anyone and whose job it is to go and attack the ball, which he has done very well.
"It's made us look a lot more solid. We're going out there now thinking we're going to win, not just hoping."

Matthew Williams was found attacking Cerys Yemm, 22, at the Sirhowy Arms Hotel in Argoed on 6 November 2014.
He was Tasered four times by police and arrested but later died.
The Newport hearing was told he had previously made death and violence threats to his ex-girlfriend, probation service staff and a police officer.
PC Jake Silver, who deals with prolific offenders through Gwent Police's Integrated Offender Management section, said Williams' former partner received seven letters from him while he was locked up.
They contained threats of violence to her as well as threats towards a serving Detective Constable and the officer's wife and his children.
In the letters, Williams described sending a car "up in smoke" and described one person as a "dead man walking".
He described intending to serve his entire sentence - to negate the need to be on licence when released - so he could go "under the radar" when he was let out.
PC Silver said he believed Williams was "very capable of carrying out the threats" but said the Crown Prosecution Service decided there was not enough evidence to peruse the matter as Williams' ex girlfriend was not willing to be a witness.
PC Silver agreed there was a "lack of urgency" surrounding the letters because of an assumption Williams would remain in prison due to a pending court case, which later collapsed.
The inquest continues.

Many lizards can detach their tails when attacked, but fish-scale geckos have large scales that tear away with ease.
The new species is a master of this art, say scientists, having the largest scales of any known gecko.
The reptile, named Geckolepis megalepis, is described in PeerJ.
The skin of fish-scale geckos is specially adapted to tearing. The large scales are attached only by a relatively narrow region that tears with ease.
In addition, beneath the scales there is a pre-formed splitting zone within the skin itself.
Although several other geckos are able to lose their skin like this if they are grasped firmly, fish-scale geckos are able to do so actively - and at the slightest touch.
They can also grow them back scar-free in a matter of weeks, while other geckos might take a long time to regenerate their scales.
But Geckolepis megalepis is remarkable for the huge size of its scales. The researchers hypothesise that larger scales tear more easily than smaller ones, because of their greater surface area relative to the attachment area, and larger friction surface.
"What's really remarkable though is that these scales - which are really dense and may even be bony, and must be quite energetically costly to produce - and the skin beneath them tear away with such ease, and can be regenerated quickly and without a scar," said lead author Mark Scherz, from the Ludwig Maximilian University of Munich.
The new species was discovered in the Tsingy cave formations of northern Madagascar.
Kyle Bartley believes assistant boss Pep Clotet deserves credit for Leeds United's improved defending.
[NEXT_CONCEPT]
A man who killed woman at a hostel had sent letters threatening to kill others while in prison, an inquest has heard.
[NEXT_CONCEPT]
A newly discovered species of gecko has tearaway skin that leaves predators with nothing but a mouthful of scales when attacked.