In this paper, we establish the nilpotency of a finite group under specific constraints on the sizes of its conjugacy classes. We prove that if the set of conjugacy class sizes of all primary elements and \(\{p,q\}\) -elements in G is precisely \(\{1, p^a,n,p^an\}\) , where a and n are positive integers satisfying \((p,n)=1\) and q is a prime divisor of n, then G must be nilpotent. Moreover, we demonstrate that necessarily n takes the form of a prime power. This result extends a recent theorem by Kong and Shi [14]. Additionally, we show that if m and n are coprime positive integers and G is a \(\pi (m)\) -solvable group such that the conjugacy class sizes of all primary and \(\{p,q\}\) -elements in G belong to \(\{1, p^a,n,p^an\}\) with all primes \(p\in \pi (m)\) and \(q\in \pi (n)\) , then G is nilpotent, and both m and n are prime powers.