Session-based recommendation (SBR) aims to exploit the session representation generated by combining item embedding and session embedding processes to recommend the next item for an anonymous user. However, most existing studies fail to fully leverage graph structures for hierarchical feature learning during item embedding. Moreover, expert experience is often relied on to set the focus area during session embeddings, which may inevitably introduce noisy information. Additionally, some models introduce inter-session collaborative information for enriching session representations but often overlook the impact of repeated item information within a session. To solve the above problems, we propose Enhancing Collaborative Information with Contrastive Learning for Session-based Recommendation, termed ECCL. Specifically, we construct a residual enhanced multi-level gated graph neural network, which captures the multi-level feature information in the graph structure and alleviates the over-smoothing problem. Meanwhile, the ECCL automatically selects the focus area length by introducing an automatic search module, such that the effect of noisy information during session embedding can be minimized. Moreover, we design a novel repetitive information-aware inter-session similarity learning module that focuses on balancing the positive and negative impacts of repeated items to fully exploit the rich inter-session collaborative information. Extensive experimental results show that the ECCL performs significantly better than other state-of-the-art methods in terms of HR@20, HR@10, MRR@20, and MRR@10, with average enhancements reaching 28.49%, 32.77%, 24.65%, and 24.95%, respectively.