Centre-half Ayala took the same path as Antonio Barragan did years earlier when Liverpool snapped him up from Sevilla before he had signed a professional contract. Ayala impressed on Liverpool's pre-season tours of Switzerland and Thailand and made his debut as a substitute in the first game of the 2009/10 season at Spurs. Ayala played from the start and with composure in Liverpool's first home League match against Stoke City and made another appearance as a late substitute for Dirk Kuyt shortly after Jamie Carragher had been sent off at Fulham. As a regular in the club's reserve team who had proved he could make the step up to the first team, it was announced on 12 November 2009 that Ayala had signed an extension to his contract that would last until 2012. To start two matches and make three substitute appearances was probably about as much as he could have hoped for in 2009/10 season. Ayala was on loan in the following season until New Year's Day 2011 and spent the remainder of the campaign at Derby. He made 17 appearances for Derby in the Championship before his loan spell ended. Hull and Swansea both bid £850,000 when he was allowed to leave Liverpool in August 2011. Norwich City also expressed an interest and it was the East Anglian club that was ultimately successful with Ayala's signature being secured on a four-year deal. An injury-hit season restricted Ayala to just ten first-team appearances for Norwich in 2011/12 and in August 2012 he secured a season-long loan deal with Nottingham Forest in the Championship.
Ayala made a dozen first-team appearances for Forest in the 2012-13 season, scoring once.
Towards the end of October 2013 Ayala moved to Middlesbrough on an emergency three-month loan-agreement. The loan was successful and at the end of it the central-defender signed a three-and-a-half year deal to stay with Middlesbrough, for whom he scored three times in twelve Championship matches in 2013/14. The following season he was a rock at the back as Boro made the play-offs, where they were beaten by Norwich in the final. He made only fourteen Premier League appearances as Boro were relegated but he remained with the club going into 2017-18. Although out of favour at the start of the season, he regained a place in the side in October and appeared 33 times, scoring an impressive 7 goals from centre back.