Born in San Lorenzo, Esmeraldas, Castillo started his career with Quito's Club Deportivo Espoli spending three years with the team, scoring a decent 11 goals in 66 appearances. He then moved across the capital to one of Ecuador's most successful sides Club Deportivo El Nacional, with whom he won successive league titles in 2005 and 2006. He again scored 11 goals in 112 matches for the club.
Castillo broke into the Ecuadorian national team in 2005, making his international debut on 17 August as a substitute against Venezuela. He became a regular player after this and was included in their squad for the 2006 FIFA World Cup. He played every minute of their World Cup campaign, where Ecuador reached the second round for the first time in their history. He has gained a starting role since the 2006 campaign, mainly as a defensive midfielder and has captained the team in a few occasions.